1
Most of this is the Neon decodetree patches, followed by Edgar's versal cleanups.
1
More accumulated patches from during the freeze...
2
2
3
thanks
3
The following changes since commit c83fcfaf8a54d0d034bd0edf7bbb3b0d16669be9:
4
-- PMM
5
4
6
5
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2021-08-26' into staging (2021-08-26 13:42:34 +0100)
7
The following changes since commit 2ef486e76d64436be90f7359a3071fb2a56ce835:
8
9
Merge remote-tracking branch 'remotes/marcel/tags/rdma-pull-request' into staging (2020-05-03 14:12:56 +0100)
10
6
11
are available in the Git repository at:
7
are available in the Git repository at:
12
8
13
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200504
9
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20210826
14
10
15
for you to fetch changes up to 9aefc6cf9b73f66062d2f914a0136756e7a28211:
11
for you to fetch changes up to d2e6f370138a7f32bc28b20dcd55374b7a638f39:
16
12
17
target/arm: Move gen_ function typedefs to translate.h (2020-05-04 12:59:26 +0100)
13
hw/arm/xlnx-zynqmp: Add unimplemented APU mmio (2021-08-26 17:02:01 +0100)
18
14
19
----------------------------------------------------------------
15
----------------------------------------------------------------
20
target-arm queue:
16
target-arm queue:
21
* Start of conversion of Neon insns to decodetree
17
* hw/dma/xlnx-zdma, xlnx_csu_dma: Require 'dma' link property to be set
22
* versal board: support SD and RTC
18
* hw/arm/Kconfig: no need to enable ACPI_MEMORY_HOTPLUG/ACPI_NVDIMM explicitly
23
* Implement ARMv8.2-TTS2UXN
19
* target/arm/cpu: Introduce sve_vq_supported bitmap
24
* Make VQDMULL undefined when U=1
20
* docs/specs: Convert ACPI spec docs to rST
25
* Some minor code cleanups
21
* arch_init: Clean up and refactoring
22
* hw/core/loader: In gunzip(), check index is in range before use, not after
23
* softmmu/physmem.c: Remove unneeded NULL check in qemu_ram_alloc_from_fd()
24
* softmmu/physmem.c: Check return value from realpath()
25
* Zero-initialize sockaddr_in structs
26
* raspi: Use error_fatal for SoC realize errors, not error_abort
27
* target/arm: Avoid assertion trying to use KVM and multiple ASes
28
* target/arm: Implement HSTR.TTEE
29
* target/arm: Implement HSTR.TJDBX
30
* target/arm: Do hflags rebuild in cpsr_write()
31
* hw/arm/xlnx-versal, xlnx-zynqmp: Add unimplemented APU mmio
26
32
27
----------------------------------------------------------------
33
----------------------------------------------------------------
28
Edgar E. Iglesias (11):
34
Andrew Jones (4):
29
hw/arm: versal: Remove inclusion of arm_gicv3_common.h
35
target/arm/cpu: Introduce sve_vq_supported bitmap
30
hw/arm: versal: Move misplaced comment
36
target/arm/kvm64: Ensure sve vls map is completely clear
31
hw/arm: versal-virt: Fix typo xlnx-ve -> xlnx-versal
37
target/arm/cpu64: Replace kvm_supported with sve_vq_supported
32
hw/arm: versal: Embed the UARTs into the SoC type
38
target/arm/cpu64: Validate sve vector lengths are supported
33
hw/arm: versal: Embed the GEMs into the SoC type
34
hw/arm: versal: Embed the ADMAs into the SoC type
35
hw/arm: versal: Embed the APUs into the SoC type
36
hw/arm: versal: Add support for SD
37
hw/arm: versal: Add support for the RTC
38
hw/arm: versal-virt: Add support for SD
39
hw/arm: versal-virt: Add support for the RTC
40
39
41
Fredrik Strupe (1):
40
Ani Sinha (1):
42
target/arm: Make VQDMULL undefined when U=1
41
hw/arm/Kconfig: no need to enable ACPI_MEMORY_HOTPLUG/ACPI_NVDIMM explicitly
43
42
44
Peter Maydell (25):
43
Peter Maydell (26):
45
target/arm: Don't use a TLB for ARMMMUIdx_Stage2
44
docs/specs/acpu_cpu_hotplug: Convert to rST
46
target/arm: Use enum constant in get_phys_addr_lpae() call
45
docs/specs/acpi_mem_hotplug: Convert to rST
47
target/arm: Add new 's1_is_el0' argument to get_phys_addr_lpae()
46
docs/specs/acpi_pci_hotplug: Convert to rST
48
target/arm: Implement ARMv8.2-TTS2UXN
47
docs/specs/acpi_nvdimm: Convert to rST
49
target/arm: Use correct variable for setting 'max' cpu's ID_AA64DFR0
48
MAINTAINERS: Add ACPI specs documents to ACPI and NVDIMM sections
50
target/arm/translate-vfp.inc.c: Remove duplicate simd_r32 check
49
softmmu: Use accel_find("xen") instead of xen_available()
51
target/arm: Don't allow Thumb Neon insns without FEATURE_NEON
50
monitor: Use accel_find("kvm") instead of kvm_available()
52
target/arm: Add stubs for AArch32 Neon decodetree
51
softmmu/arch_init.c: Trim down include list
53
target/arm: Convert VCMLA (vector) to decodetree
52
meson.build: Define QEMU_ARCH in config-target.h
54
target/arm: Convert VCADD (vector) to decodetree
53
arch_init.h: Add QEMU_ARCH_HEXAGON
55
target/arm: Convert V[US]DOT (vector) to decodetree
54
arch_init.h: Move QEMU_ARCH_VIRTIO_* to qdev-monitor.c
56
target/arm: Convert VFM[AS]L (vector) to decodetree
55
arch_init.h: Don't include arch_init.h unnecessarily
57
target/arm: Convert VCMLA (scalar) to decodetree
56
stubs: Remove unused arch_type.c stub
58
target/arm: Convert V[US]DOT (scalar) to decodetree
57
hw/core/loader: In gunzip(), check index is in range before use, not after
59
target/arm: Convert VFM[AS]L (scalar) to decodetree
58
softmmu/physmem.c: Remove unneeded NULL check in qemu_ram_alloc_from_fd()
60
target/arm: Convert Neon load/store multiple structures to decodetree
59
softmmu/physmem.c: Check return value from realpath()
61
target/arm: Convert Neon 'load single structure to all lanes' to decodetree
60
net: Zero sockaddr_in in parse_host_port()
62
target/arm: Convert Neon 'load/store single structure' to decodetree
61
gdbstub: Zero-initialize sockaddr structs
63
target/arm: Convert Neon 3-reg-same VADD/VSUB to decodetree
62
tests/qtest/ipmi-bt-test: Zero-initialize sockaddr struct
64
target/arm: Convert Neon 3-reg-same logic ops to decodetree
63
tests/tcg/multiarch/linux-test: Zero-initialize sockaddr structs
65
target/arm: Convert Neon 3-reg-same VMAX/VMIN to decodetree
64
raspi: Use error_fatal for SoC realize errors, not error_abort
66
target/arm: Convert Neon 3-reg-same comparisons to decodetree
65
target/arm: Avoid assertion trying to use KVM and multiple ASes
67
target/arm: Convert Neon 3-reg-same VQADD/VQSUB to decodetree
66
hw/arm/virt: Delete EL3 error checksnow provided in CPU realize
68
target/arm: Convert Neon 3-reg-same VMUL, VMLA, VMLS, VSHL to decodetree
67
target/arm: Implement HSTR.TTEE
69
target/arm: Move gen_ function typedefs to translate.h
68
target/arm: Implement HSTR.TJDBX
69
target/arm: Do hflags rebuild in cpsr_write()
70
70
71
Philippe Mathieu-Daudé (2):
71
Philippe Mathieu-Daudé (4):
72
hw/arm/mps2-tz: Use TYPE_IOTKIT instead of hardcoded string
72
hw/arm/xlnx-zynqmp: Realize qspi controller *after* qspi_dma
73
target/arm: Use uint64_t for midr field in CPU state struct
73
hw/dma/xlnx_csu_dma: Run trivial checks early in realize()
74
hw/dma/xlnx_csu_dma: Always expect 'dma' link property to be set
75
hw/dma/xlnx-zdma Always expect 'dma' link property to be set
74
76
75
include/hw/arm/xlnx-versal.h | 31 +-
77
Tong Ho (2):
76
target/arm/cpu-param.h | 2 +-
78
hw/arm/xlnx-versal: Add unimplemented APU mmio
77
target/arm/cpu.h | 38 ++-
79
hw/arm/xlnx-zynqmp: Add unimplemented APU mmio
78
target/arm/translate-a64.h | 9 -
79
target/arm/translate.h | 26 ++
80
target/arm/neon-dp.decode | 86 +++++
81
target/arm/neon-ls.decode | 52 +++
82
target/arm/neon-shared.decode | 66 ++++
83
hw/arm/mps2-tz.c | 2 +-
84
hw/arm/xlnx-versal-virt.c | 74 ++++-
85
hw/arm/xlnx-versal.c | 115 +++++--
86
target/arm/cpu.c | 3 +-
87
target/arm/cpu64.c | 8 +-
88
target/arm/helper.c | 183 ++++------
89
target/arm/translate-a64.c | 17 -
90
target/arm/translate-neon.inc.c | 714 +++++++++++++++++++++++++++++++++++++++
91
target/arm/translate-vfp.inc.c | 6 -
92
target/arm/translate.c | 716 +++-------------------------------------
93
target/arm/Makefile.objs | 18 +
94
19 files changed, 1302 insertions(+), 864 deletions(-)
95
create mode 100644 target/arm/neon-dp.decode
96
create mode 100644 target/arm/neon-ls.decode
97
create mode 100644 target/arm/neon-shared.decode
98
create mode 100644 target/arm/translate-neon.inc.c
99
80
81
docs/specs/acpi_cpu_hotplug.rst | 235 +++++++++++++++++++++
82
docs/specs/acpi_cpu_hotplug.txt | 160 --------------
83
docs/specs/acpi_mem_hotplug.rst | 128 +++++++++++
84
docs/specs/acpi_mem_hotplug.txt | 94 ---------
85
docs/specs/acpi_nvdimm.rst | 228 ++++++++++++++++++++
86
docs/specs/acpi_nvdimm.txt | 188 -----------------
87
.../{acpi_pci_hotplug.txt => acpi_pci_hotplug.rst} | 37 ++--
88
docs/specs/index.rst | 4 +
89
meson.build | 2 +
90
include/hw/arm/xlnx-versal.h | 2 +
91
include/hw/arm/xlnx-zynqmp.h | 7 +
92
include/hw/dma/xlnx-zdma.h | 2 +-
93
include/hw/dma/xlnx_csu_dma.h | 2 +-
94
include/sysemu/arch_init.h | 15 +-
95
target/arm/cpu.h | 17 +-
96
target/arm/helper.h | 2 +
97
target/arm/syndrome.h | 7 +
98
blockdev.c | 1 -
99
gdbstub.c | 4 +-
100
hw/arm/raspi.c | 2 +-
101
hw/arm/virt.c | 5 -
102
hw/arm/xlnx-versal.c | 4 +
103
hw/arm/xlnx-zynqmp.c | 86 ++++++--
104
hw/core/loader.c | 35 ++-
105
hw/dma/xlnx-zdma.c | 24 +--
106
hw/dma/xlnx_csu_dma.c | 31 ++-
107
hw/i386/pc.c | 1 -
108
hw/i386/pc_piix.c | 1 -
109
hw/i386/pc_q35.c | 1 -
110
hw/mips/jazz.c | 1 -
111
hw/mips/malta.c | 1 -
112
hw/ppc/prep.c | 1 -
113
hw/riscv/sifive_e.c | 1 -
114
hw/riscv/sifive_u.c | 1 -
115
hw/riscv/spike.c | 1 -
116
hw/riscv/virt.c | 1 -
117
linux-user/arm/signal.c | 2 -
118
monitor/qmp-cmds.c | 3 +-
119
net/net.c | 2 +
120
softmmu/arch_init.c | 66 ------
121
softmmu/physmem.c | 5 +-
122
softmmu/qdev-monitor.c | 9 +
123
softmmu/vl.c | 6 +-
124
stubs/arch_type.c | 4 -
125
target/arm/cpu.c | 23 ++
126
target/arm/cpu64.c | 118 +++++------
127
target/arm/helper.c | 40 +++-
128
target/arm/kvm64.c | 2 +-
129
target/arm/op_helper.c | 16 ++
130
target/arm/translate.c | 12 ++
131
target/ppc/cpu_init.c | 1 -
132
target/s390x/cpu-sysemu.c | 1 -
133
tests/qtest/ipmi-bt-test.c | 2 +-
134
tests/tcg/multiarch/linux-test.c | 4 +-
135
MAINTAINERS | 5 +
136
hw/arm/Kconfig | 2 -
137
stubs/meson.build | 1 -
138
57 files changed, 949 insertions(+), 707 deletions(-)
139
create mode 100644 docs/specs/acpi_cpu_hotplug.rst
140
delete mode 100644 docs/specs/acpi_cpu_hotplug.txt
141
create mode 100644 docs/specs/acpi_mem_hotplug.rst
142
delete mode 100644 docs/specs/acpi_mem_hotplug.txt
143
create mode 100644 docs/specs/acpi_nvdimm.rst
144
delete mode 100644 docs/specs/acpi_nvdimm.txt
145
rename docs/specs/{acpi_pci_hotplug.txt => acpi_pci_hotplug.rst} (51%)
146
delete mode 100644 stubs/arch_type.c
147
diff view generated by jsdifflib
1
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
2
2
3
Add support for the RTC.
3
If we link QOM object (a) as a property of QOM object (b),
4
we must set the property *before* (b) is realized.
4
5
5
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
6
Move QSPI realization *after* QSPI DMA.
7
8
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
6
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
9
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
7
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
10
Message-id: 20210819163422.2863447-2-philmd@redhat.com
8
Message-id: 20200427181649.26851-12-edgar.iglesias@gmail.com
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
12
---
11
hw/arm/xlnx-versal-virt.c | 22 ++++++++++++++++++++++
13
hw/arm/xlnx-zynqmp.c | 42 ++++++++++++++++++++----------------------
12
1 file changed, 22 insertions(+)
14
1 file changed, 20 insertions(+), 22 deletions(-)
13
15
14
diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
16
diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c
15
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/arm/xlnx-versal-virt.c
18
--- a/hw/arm/xlnx-zynqmp.c
17
+++ b/hw/arm/xlnx-versal-virt.c
19
+++ b/hw/arm/xlnx-zynqmp.c
18
@@ -XXX,XX +XXX,XX @@ static void fdt_add_sd_nodes(VersalVirt *s)
20
@@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
21
g_free(bus_name);
19
}
22
}
23
24
- if (!sysbus_realize(SYS_BUS_DEVICE(&s->qspi), errp)) {
25
- return;
26
- }
27
- sysbus_mmio_map(SYS_BUS_DEVICE(&s->qspi), 0, QSPI_ADDR);
28
- sysbus_mmio_map(SYS_BUS_DEVICE(&s->qspi), 1, LQSPI_ADDR);
29
- sysbus_connect_irq(SYS_BUS_DEVICE(&s->qspi), 0, gic_spi[QSPI_IRQ]);
30
-
31
- for (i = 0; i < XLNX_ZYNQMP_NUM_QSPI_BUS; i++) {
32
- gchar *bus_name;
33
- gchar *target_bus;
34
-
35
- /* Alias controller SPI bus to the SoC itself */
36
- bus_name = g_strdup_printf("qspi%d", i);
37
- target_bus = g_strdup_printf("spi%d", i);
38
- object_property_add_alias(OBJECT(s), bus_name,
39
- OBJECT(&s->qspi), target_bus);
40
- g_free(bus_name);
41
- g_free(target_bus);
42
- }
43
-
44
if (!sysbus_realize(SYS_BUS_DEVICE(&s->dp), errp)) {
45
return;
46
}
47
@@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
48
49
sysbus_mmio_map(SYS_BUS_DEVICE(&s->qspi_dma), 0, QSPI_DMA_ADDR);
50
sysbus_connect_irq(SYS_BUS_DEVICE(&s->qspi_dma), 0, gic_spi[QSPI_IRQ]);
51
- object_property_set_link(OBJECT(&s->qspi), "stream-connected-dma",
52
- OBJECT(&s->qspi_dma), errp);
53
+
54
+ if (!object_property_set_link(OBJECT(&s->qspi), "stream-connected-dma",
55
+ OBJECT(&s->qspi_dma), errp)) {
56
+ return;
57
+ }
58
+ if (!sysbus_realize(SYS_BUS_DEVICE(&s->qspi), errp)) {
59
+ return;
60
+ }
61
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->qspi), 0, QSPI_ADDR);
62
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->qspi), 1, LQSPI_ADDR);
63
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->qspi), 0, gic_spi[QSPI_IRQ]);
64
+
65
+ for (i = 0; i < XLNX_ZYNQMP_NUM_QSPI_BUS; i++) {
66
+ g_autofree gchar *bus_name = g_strdup_printf("qspi%d", i);
67
+ g_autofree gchar *target_bus = g_strdup_printf("spi%d", i);
68
+
69
+ /* Alias controller SPI bus to the SoC itself */
70
+ object_property_add_alias(OBJECT(s), bus_name,
71
+ OBJECT(&s->qspi), target_bus);
72
+ }
20
}
73
}
21
74
22
+static void fdt_add_rtc_node(VersalVirt *s)
75
static Property xlnx_zynqmp_props[] = {
23
+{
24
+ const char compat[] = "xlnx,zynqmp-rtc";
25
+ const char interrupt_names[] = "alarm\0sec";
26
+ char *name = g_strdup_printf("/rtc@%x", MM_PMC_RTC);
27
+
28
+ qemu_fdt_add_subnode(s->fdt, name);
29
+
30
+ qemu_fdt_setprop_cells(s->fdt, name, "interrupts",
31
+ GIC_FDT_IRQ_TYPE_SPI, VERSAL_RTC_ALARM_IRQ,
32
+ GIC_FDT_IRQ_FLAGS_LEVEL_HI,
33
+ GIC_FDT_IRQ_TYPE_SPI, VERSAL_RTC_SECONDS_IRQ,
34
+ GIC_FDT_IRQ_FLAGS_LEVEL_HI);
35
+ qemu_fdt_setprop(s->fdt, name, "interrupt-names",
36
+ interrupt_names, sizeof(interrupt_names));
37
+ qemu_fdt_setprop_sized_cells(s->fdt, name, "reg",
38
+ 2, MM_PMC_RTC, 2, MM_PMC_RTC_SIZE);
39
+ qemu_fdt_setprop(s->fdt, name, "compatible", compat, sizeof(compat));
40
+ g_free(name);
41
+}
42
+
43
static void fdt_nop_memory_nodes(void *fdt, Error **errp)
44
{
45
Error *err = NULL;
46
@@ -XXX,XX +XXX,XX @@ static void versal_virt_init(MachineState *machine)
47
fdt_add_timer_nodes(s);
48
fdt_add_zdma_nodes(s);
49
fdt_add_sd_nodes(s);
50
+ fdt_add_rtc_node(s);
51
fdt_add_cpu_nodes(s, psci_conduit);
52
fdt_add_clk_node(s, "/clk125", 125000000, s->phandle.clk_125Mhz);
53
fdt_add_clk_node(s, "/clk25", 25000000, s->phandle.clk_25Mhz);
54
--
76
--
55
2.20.1
77
2.20.1
56
78
57
79
diff view generated by jsdifflib
1
Convert the VFM[AS]L (scalar) insns in the 2reg-scalar-ext group
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
2
to decodetree. These are the last ones in the group so we can remove
3
all the legacy decode for the group.
4
2
5
Note that in disas_thumb2_insn() the parts of this encoding space
3
If some property are not set, we'll return indicating a failure,
6
where the decodetree decoder returns false will correctly be directed
4
so it is pointless to allocate / initialize some fields too early.
7
to illegal_op by the "(insn & (1 << 28))" check so they won't fall
5
Move the trivial checks earlier in realize().
8
into disas_coproc_insn() by mistake.
9
6
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
9
Message-id: 20210819163422.2863447-3-philmd@redhat.com
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
12
Message-id: 20200430181003.21682-11-peter.maydell@linaro.org
13
---
11
---
14
target/arm/neon-shared.decode | 7 +++
12
hw/dma/xlnx_csu_dma.c | 10 +++++-----
15
target/arm/translate-neon.inc.c | 32 ++++++++++
13
1 file changed, 5 insertions(+), 5 deletions(-)
16
target/arm/translate.c | 107 +-------------------------------
17
3 files changed, 40 insertions(+), 106 deletions(-)
18
14
19
diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode
15
diff --git a/hw/dma/xlnx_csu_dma.c b/hw/dma/xlnx_csu_dma.c
20
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
21
--- a/target/arm/neon-shared.decode
17
--- a/hw/dma/xlnx_csu_dma.c
22
+++ b/target/arm/neon-shared.decode
18
+++ b/hw/dma/xlnx_csu_dma.c
23
@@ -XXX,XX +XXX,XX @@ VCMLA_scalar 1111 1110 1 . rot:2 .... .... 1000 . q:1 . 0 .... \
19
@@ -XXX,XX +XXX,XX @@ static void xlnx_csu_dma_realize(DeviceState *dev, Error **errp)
24
20
XlnxCSUDMA *s = XLNX_CSU_DMA(dev);
25
VDOT_scalar 1111 1110 0 . 10 .... .... 1101 . q:1 index:1 u:1 rm:4 \
21
RegisterInfoArray *reg_array;
26
vm=%vm_dp vn=%vn_dp vd=%vd_dp
22
27
+
23
+ if (!s->is_dst && !s->tx_dev) {
28
+%vfml_scalar_q0_rm 0:3 5:1
24
+ error_setg(errp, "zynqmp.csu-dma: Stream not connected");
29
+%vfml_scalar_q1_index 5:1 3:1
25
+ return;
30
+VFML_scalar 1111 1110 0 . 0 s:1 .... .... 1000 . 0 . 1 index:1 ... \
31
+ rm=%vfml_scalar_q0_rm vn=%vn_sp vd=%vd_dp q=0
32
+VFML_scalar 1111 1110 0 . 0 s:1 .... .... 1000 . 1 . 1 . rm:3 \
33
+ index=%vfml_scalar_q1_index vn=%vn_dp vd=%vd_dp q=1
34
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
35
index XXXXXXX..XXXXXXX 100644
36
--- a/target/arm/translate-neon.inc.c
37
+++ b/target/arm/translate-neon.inc.c
38
@@ -XXX,XX +XXX,XX @@ static bool trans_VDOT_scalar(DisasContext *s, arg_VDOT_scalar *a)
39
tcg_temp_free_ptr(fpst);
40
return true;
41
}
42
+
43
+static bool trans_VFML_scalar(DisasContext *s, arg_VFML_scalar *a)
44
+{
45
+ int opr_sz;
46
+
47
+ if (!dc_isar_feature(aa32_fhm, s)) {
48
+ return false;
49
+ }
26
+ }
50
+
27
+
51
+ /* UNDEF accesses to D16-D31 if they don't exist. */
28
reg_array =
52
+ if (!dc_isar_feature(aa32_simd_r32, s) &&
29
register_init_block32(dev, xlnx_csu_dma_regs_info[!!s->is_dst],
53
+ ((a->vd & 0x10) || (a->q && (a->vn & 0x10)))) {
30
XLNX_CSU_DMA_R_MAX,
54
+ return false;
31
@@ -XXX,XX +XXX,XX @@ static void xlnx_csu_dma_realize(DeviceState *dev, Error **errp)
55
+ }
32
sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem);
56
+
33
sysbus_init_irq(SYS_BUS_DEVICE(dev), &s->irq);
57
+ if (a->vd & a->q) {
34
58
+ return false;
35
- if (!s->is_dst && !s->tx_dev) {
59
+ }
36
- error_setg(errp, "zynqmp.csu-dma: Stream not connected");
60
+
37
- return;
61
+ if (!vfp_access_check(s)) {
62
+ return true;
63
+ }
64
+
65
+ opr_sz = (1 + a->q) * 8;
66
+ tcg_gen_gvec_3_ptr(vfp_reg_offset(1, a->vd),
67
+ vfp_reg_offset(a->q, a->vn),
68
+ vfp_reg_offset(a->q, a->rm),
69
+ cpu_env, opr_sz, opr_sz,
70
+ (a->index << 2) | a->s, /* is_2 == 0 */
71
+ gen_helper_gvec_fmlal_idx_a32);
72
+ return true;
73
+}
74
diff --git a/target/arm/translate.c b/target/arm/translate.c
75
index XXXXXXX..XXXXXXX 100644
76
--- a/target/arm/translate.c
77
+++ b/target/arm/translate.c
78
@@ -XXX,XX +XXX,XX @@ static int disas_dsp_insn(DisasContext *s, uint32_t insn)
79
}
80
81
#define VFP_REG_SHR(x, n) (((n) > 0) ? (x) >> (n) : (x) << -(n))
82
-#define VFP_SREG(insn, bigbit, smallbit) \
83
- ((VFP_REG_SHR(insn, bigbit - 1) & 0x1e) | (((insn) >> (smallbit)) & 1))
84
#define VFP_DREG(reg, insn, bigbit, smallbit) do { \
85
if (dc_isar_feature(aa32_simd_r32, s)) { \
86
reg = (((insn) >> (bigbit)) & 0x0f) \
87
@@ -XXX,XX +XXX,XX @@ static int disas_dsp_insn(DisasContext *s, uint32_t insn)
88
reg = ((insn) >> (bigbit)) & 0x0f; \
89
}} while (0)
90
91
-#define VFP_SREG_D(insn) VFP_SREG(insn, 12, 22)
92
#define VFP_DREG_D(reg, insn) VFP_DREG(reg, insn, 12, 22)
93
-#define VFP_SREG_N(insn) VFP_SREG(insn, 16, 7)
94
#define VFP_DREG_N(reg, insn) VFP_DREG(reg, insn, 16, 7)
95
-#define VFP_SREG_M(insn) VFP_SREG(insn, 0, 5)
96
#define VFP_DREG_M(reg, insn) VFP_DREG(reg, insn, 0, 5)
97
98
static void gen_neon_dup_low16(TCGv_i32 var)
99
@@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
100
return 0;
101
}
102
103
-/* Advanced SIMD two registers and a scalar extension.
104
- * 31 24 23 22 20 16 12 11 10 9 8 3 0
105
- * +-----------------+----+---+----+----+----+---+----+---+----+---------+----+
106
- * | 1 1 1 1 1 1 1 0 | o1 | D | o2 | Vn | Vd | 1 | o3 | 0 | o4 | N Q M U | Vm |
107
- * +-----------------+----+---+----+----+----+---+----+---+----+---------+----+
108
- *
109
- */
110
-
111
-static int disas_neon_insn_2reg_scalar_ext(DisasContext *s, uint32_t insn)
112
-{
113
- gen_helper_gvec_3 *fn_gvec = NULL;
114
- gen_helper_gvec_3_ptr *fn_gvec_ptr = NULL;
115
- int rd, rn, rm, opr_sz, data;
116
- int off_rn, off_rm;
117
- bool is_long = false, q = extract32(insn, 6, 1);
118
- bool ptr_is_env = false;
119
-
120
- if ((insn & 0xffa00f10) == 0xfe000810) {
121
- /* VFM[AS]L -- 1111 1110 0.0S .... .... 1000 .Q.1 .... */
122
- int is_s = extract32(insn, 20, 1);
123
- int vm20 = extract32(insn, 0, 3);
124
- int vm3 = extract32(insn, 3, 1);
125
- int m = extract32(insn, 5, 1);
126
- int index;
127
-
128
- if (!dc_isar_feature(aa32_fhm, s)) {
129
- return 1;
130
- }
131
- if (q) {
132
- rm = vm20;
133
- index = m * 2 + vm3;
134
- } else {
135
- rm = vm20 * 2 + m;
136
- index = vm3;
137
- }
138
- is_long = true;
139
- data = (index << 2) | is_s; /* is_2 == 0 */
140
- fn_gvec_ptr = gen_helper_gvec_fmlal_idx_a32;
141
- ptr_is_env = true;
142
- } else {
143
- return 1;
144
- }
38
- }
145
-
39
-
146
- VFP_DREG_D(rd, insn);
40
s->src_timer = ptimer_init(xlnx_csu_dma_src_timeout_hit,
147
- if (rd & q) {
41
s, PTIMER_POLICY_DEFAULT);
148
- return 1;
42
149
- }
150
- if (q || !is_long) {
151
- VFP_DREG_N(rn, insn);
152
- if (rn & q & !is_long) {
153
- return 1;
154
- }
155
- off_rn = vfp_reg_offset(1, rn);
156
- off_rm = vfp_reg_offset(1, rm);
157
- } else {
158
- rn = VFP_SREG_N(insn);
159
- off_rn = vfp_reg_offset(0, rn);
160
- off_rm = vfp_reg_offset(0, rm);
161
- }
162
- if (s->fp_excp_el) {
163
- gen_exception_insn(s, s->pc_curr, EXCP_UDEF,
164
- syn_simd_access_trap(1, 0xe, false), s->fp_excp_el);
165
- return 0;
166
- }
167
- if (!s->vfp_enabled) {
168
- return 1;
169
- }
170
-
171
- opr_sz = (1 + q) * 8;
172
- if (fn_gvec_ptr) {
173
- TCGv_ptr ptr;
174
- if (ptr_is_env) {
175
- ptr = cpu_env;
176
- } else {
177
- ptr = get_fpstatus_ptr(1);
178
- }
179
- tcg_gen_gvec_3_ptr(vfp_reg_offset(1, rd), off_rn, off_rm, ptr,
180
- opr_sz, opr_sz, data, fn_gvec_ptr);
181
- if (!ptr_is_env) {
182
- tcg_temp_free_ptr(ptr);
183
- }
184
- } else {
185
- tcg_gen_gvec_3_ool(vfp_reg_offset(1, rd), off_rn, off_rm,
186
- opr_sz, opr_sz, data, fn_gvec);
187
- }
188
- return 0;
189
-}
190
-
191
static int disas_coproc_insn(DisasContext *s, uint32_t insn)
192
{
193
int cpnum, is64, crn, crm, opc1, opc2, isread, rt, rt2;
194
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
195
}
196
}
197
}
198
- } else if ((insn & 0x0f000a00) == 0x0e000800
199
- && arm_dc_feature(s, ARM_FEATURE_V8)) {
200
- if (disas_neon_insn_2reg_scalar_ext(s, insn)) {
201
- goto illegal_op;
202
- }
203
- return;
204
}
205
goto illegal_op;
206
}
207
@@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn)
208
}
209
break;
210
}
211
- if ((insn & 0xff000a00) == 0xfe000800
212
- && arm_dc_feature(s, ARM_FEATURE_V8)) {
213
- /* The Thumb2 and ARM encodings are identical. */
214
- if (disas_neon_insn_2reg_scalar_ext(s, insn)) {
215
- goto illegal_op;
216
- }
217
- } else if (((insn >> 24) & 3) == 3) {
218
+ if (((insn >> 24) & 3) == 3) {
219
/* Translate into the equivalent ARM encoding. */
220
insn = (insn & 0xe2ffffff) | ((insn & (1 << 28)) >> 4) | (1 << 28);
221
if (disas_neon_data_insn(s, insn)) {
222
--
43
--
223
2.20.1
44
2.20.1
224
45
225
46
diff view generated by jsdifflib
1
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
2
2
3
Fix typo xlnx-ve -> xlnx-versal.
3
Simplify by always passing a MemoryRegion property to the device.
4
Doing so we can move the AddressSpace field to the device struct,
5
removing need for heap allocation.
4
6
5
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
7
Update the Xilinx ZynqMP SoC model to pass the default system
6
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
8
memory instead of a NULL value.
7
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
8
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
10
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
9
Message-id: 20200427181649.26851-4-edgar.iglesias@gmail.com
11
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
12
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
13
Message-id: 20210819163422.2863447-4-philmd@redhat.com
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
15
---
12
hw/arm/xlnx-versal-virt.c | 2 +-
16
include/hw/dma/xlnx_csu_dma.h | 2 +-
13
1 file changed, 1 insertion(+), 1 deletion(-)
17
hw/arm/xlnx-zynqmp.c | 4 ++++
18
hw/dma/xlnx_csu_dma.c | 21 ++++++++++-----------
19
3 files changed, 15 insertions(+), 12 deletions(-)
14
20
15
diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
21
diff --git a/include/hw/dma/xlnx_csu_dma.h b/include/hw/dma/xlnx_csu_dma.h
16
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/arm/xlnx-versal-virt.c
23
--- a/include/hw/dma/xlnx_csu_dma.h
18
+++ b/hw/arm/xlnx-versal-virt.c
24
+++ b/include/hw/dma/xlnx_csu_dma.h
19
@@ -XXX,XX +XXX,XX @@ static void versal_virt_init(MachineState *machine)
25
@@ -XXX,XX +XXX,XX @@ typedef struct XlnxCSUDMA {
20
psci_conduit = QEMU_PSCI_CONDUIT_SMC;
26
MemoryRegion iomem;
27
MemTxAttrs attr;
28
MemoryRegion *dma_mr;
29
- AddressSpace *dma_as;
30
+ AddressSpace dma_as;
31
qemu_irq irq;
32
StreamSink *tx_dev; /* Used as generic StreamSink */
33
ptimer_state *src_timer;
34
diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c
35
index XXXXXXX..XXXXXXX 100644
36
--- a/hw/arm/xlnx-zynqmp.c
37
+++ b/hw/arm/xlnx-zynqmp.c
38
@@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
39
gic_spi[adma_ch_intr[i]]);
21
}
40
}
22
41
23
- sysbus_init_child_obj(OBJECT(machine), "xlnx-ve", &s->soc,
42
+ if (!object_property_set_link(OBJECT(&s->qspi_dma), "dma",
24
+ sysbus_init_child_obj(OBJECT(machine), "xlnx-versal", &s->soc,
43
+ OBJECT(system_memory), errp)) {
25
sizeof(s->soc), TYPE_XLNX_VERSAL);
44
+ return;
26
object_property_set_link(OBJECT(&s->soc), OBJECT(machine->ram),
45
+ }
27
"ddr", &error_abort);
46
if (!sysbus_realize(SYS_BUS_DEVICE(&s->qspi_dma), errp)) {
47
return;
48
}
49
diff --git a/hw/dma/xlnx_csu_dma.c b/hw/dma/xlnx_csu_dma.c
50
index XXXXXXX..XXXXXXX 100644
51
--- a/hw/dma/xlnx_csu_dma.c
52
+++ b/hw/dma/xlnx_csu_dma.c
53
@@ -XXX,XX +XXX,XX @@ static uint32_t xlnx_csu_dma_read(XlnxCSUDMA *s, uint8_t *buf, uint32_t len)
54
for (i = 0; i < len && (result == MEMTX_OK); i += s->width) {
55
uint32_t mlen = MIN(len - i, s->width);
56
57
- result = address_space_rw(s->dma_as, addr, s->attr,
58
+ result = address_space_rw(&s->dma_as, addr, s->attr,
59
buf + i, mlen, false);
60
}
61
} else {
62
- result = address_space_rw(s->dma_as, addr, s->attr, buf, len, false);
63
+ result = address_space_rw(&s->dma_as, addr, s->attr, buf, len, false);
64
}
65
66
if (result == MEMTX_OK) {
67
@@ -XXX,XX +XXX,XX @@ static uint32_t xlnx_csu_dma_write(XlnxCSUDMA *s, uint8_t *buf, uint32_t len)
68
for (i = 0; i < len && (result == MEMTX_OK); i += s->width) {
69
uint32_t mlen = MIN(len - i, s->width);
70
71
- result = address_space_rw(s->dma_as, addr, s->attr,
72
+ result = address_space_rw(&s->dma_as, addr, s->attr,
73
buf, mlen, true);
74
buf += mlen;
75
}
76
} else {
77
- result = address_space_rw(s->dma_as, addr, s->attr, buf, len, true);
78
+ result = address_space_rw(&s->dma_as, addr, s->attr, buf, len, true);
79
}
80
81
if (result != MEMTX_OK) {
82
@@ -XXX,XX +XXX,XX @@ static void xlnx_csu_dma_realize(DeviceState *dev, Error **errp)
83
return;
84
}
85
86
+ if (!s->dma_mr) {
87
+ error_setg(errp, TYPE_XLNX_CSU_DMA " 'dma' link not set");
88
+ return;
89
+ }
90
+ address_space_init(&s->dma_as, s->dma_mr, "csu-dma");
91
+
92
reg_array =
93
register_init_block32(dev, xlnx_csu_dma_regs_info[!!s->is_dst],
94
XLNX_CSU_DMA_R_MAX,
95
@@ -XXX,XX +XXX,XX @@ static void xlnx_csu_dma_realize(DeviceState *dev, Error **errp)
96
s->src_timer = ptimer_init(xlnx_csu_dma_src_timeout_hit,
97
s, PTIMER_POLICY_DEFAULT);
98
99
- if (s->dma_mr) {
100
- s->dma_as = g_malloc0(sizeof(AddressSpace));
101
- address_space_init(s->dma_as, s->dma_mr, NULL);
102
- } else {
103
- s->dma_as = &address_space_memory;
104
- }
105
-
106
s->attr = MEMTXATTRS_UNSPECIFIED;
107
108
s->r_size_last_word = 0;
28
--
109
--
29
2.20.1
110
2.20.1
30
111
31
112
diff view generated by jsdifflib
1
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
2
2
3
hw/arm: versal: Add support for the RTC.
3
Simplify by always passing a MemoryRegion property to the device.
4
Doing so we can move the AddressSpace field to the device struct,
5
removing need for heap allocation.
4
6
5
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
7
Update the Xilinx ZynqMP / Versal SoC models to pass the default
6
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
system memory instead of a NULL value.
7
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
9
8
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
10
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
9
Message-id: 20200427181649.26851-10-edgar.iglesias@gmail.com
11
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
12
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
13
Message-id: 20210819163422.2863447-5-philmd@redhat.com
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
15
---
12
include/hw/arm/xlnx-versal.h | 8 ++++++++
16
include/hw/dma/xlnx-zdma.h | 2 +-
13
hw/arm/xlnx-versal.c | 21 +++++++++++++++++++++
17
hw/arm/xlnx-versal.c | 2 ++
14
2 files changed, 29 insertions(+)
18
hw/arm/xlnx-zynqmp.c | 8 ++++++++
19
hw/dma/xlnx-zdma.c | 24 ++++++++++++------------
20
4 files changed, 23 insertions(+), 13 deletions(-)
15
21
16
diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
22
diff --git a/include/hw/dma/xlnx-zdma.h b/include/hw/dma/xlnx-zdma.h
17
index XXXXXXX..XXXXXXX 100644
23
index XXXXXXX..XXXXXXX 100644
18
--- a/include/hw/arm/xlnx-versal.h
24
--- a/include/hw/dma/xlnx-zdma.h
19
+++ b/include/hw/arm/xlnx-versal.h
25
+++ b/include/hw/dma/xlnx-zdma.h
20
@@ -XXX,XX +XXX,XX @@
26
@@ -XXX,XX +XXX,XX @@ struct XlnxZDMA {
21
#include "hw/char/pl011.h"
27
MemoryRegion iomem;
22
#include "hw/dma/xlnx-zdma.h"
28
MemTxAttrs attr;
23
#include "hw/net/cadence_gem.h"
29
MemoryRegion *dma_mr;
24
+#include "hw/rtc/xlnx-zynqmp-rtc.h"
30
- AddressSpace *dma_as;
25
31
+ AddressSpace dma_as;
26
#define TYPE_XLNX_VERSAL "xlnx-versal"
32
qemu_irq irq_zdma_ch_imr;
27
#define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL)
28
@@ -XXX,XX +XXX,XX @@ typedef struct Versal {
29
struct {
30
SDHCIState sd[XLNX_VERSAL_NR_SDS];
31
} iou;
32
+
33
+ XlnxZynqMPRTC rtc;
34
} pmc;
35
33
36
struct {
34
struct {
37
@@ -XXX,XX +XXX,XX @@ typedef struct Versal {
38
#define VERSAL_GEM1_IRQ_0 58
39
#define VERSAL_GEM1_WAKE_IRQ_0 59
40
#define VERSAL_ADMA_IRQ_0 60
41
+#define VERSAL_RTC_APB_ERR_IRQ 121
42
#define VERSAL_SD0_IRQ_0 126
43
+#define VERSAL_RTC_ALARM_IRQ 142
44
+#define VERSAL_RTC_SECONDS_IRQ 143
45
46
/* Architecturally reserved IRQs suitable for virtualization. */
47
#define VERSAL_RSVD_IRQ_FIRST 111
48
@@ -XXX,XX +XXX,XX @@ typedef struct Versal {
49
#define MM_PMC_SD0_SIZE 0x10000
50
#define MM_PMC_CRP 0xf1260000U
51
#define MM_PMC_CRP_SIZE 0x10000
52
+#define MM_PMC_RTC 0xf12a0000
53
+#define MM_PMC_RTC_SIZE 0x10000
54
#endif
55
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
35
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
56
index XXXXXXX..XXXXXXX 100644
36
index XXXXXXX..XXXXXXX 100644
57
--- a/hw/arm/xlnx-versal.c
37
--- a/hw/arm/xlnx-versal.c
58
+++ b/hw/arm/xlnx-versal.c
38
+++ b/hw/arm/xlnx-versal.c
59
@@ -XXX,XX +XXX,XX @@ static void versal_create_sds(Versal *s, qemu_irq *pic)
39
@@ -XXX,XX +XXX,XX @@ static void versal_create_admas(Versal *s, qemu_irq *pic)
40
TYPE_XLNX_ZDMA);
41
dev = DEVICE(&s->lpd.iou.adma[i]);
42
object_property_set_int(OBJECT(dev), "bus-width", 128, &error_abort);
43
+ object_property_set_link(OBJECT(dev), "dma",
44
+ OBJECT(get_system_memory()), &error_fatal);
45
sysbus_realize(SYS_BUS_DEVICE(dev), &error_fatal);
46
47
mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0);
48
diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c
49
index XXXXXXX..XXXXXXX 100644
50
--- a/hw/arm/xlnx-zynqmp.c
51
+++ b/hw/arm/xlnx-zynqmp.c
52
@@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
53
errp)) {
54
return;
55
}
56
+ if (!object_property_set_link(OBJECT(&s->gdma[i]), "dma",
57
+ OBJECT(system_memory), errp)) {
58
+ return;
59
+ }
60
if (!sysbus_realize(SYS_BUS_DEVICE(&s->gdma[i]), errp)) {
61
return;
62
}
63
@@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
60
}
64
}
65
66
for (i = 0; i < XLNX_ZYNQMP_NUM_ADMA_CH; i++) {
67
+ if (!object_property_set_link(OBJECT(&s->adma[i]), "dma",
68
+ OBJECT(system_memory), errp)) {
69
+ return;
70
+ }
71
if (!sysbus_realize(SYS_BUS_DEVICE(&s->adma[i]), errp)) {
72
return;
73
}
74
diff --git a/hw/dma/xlnx-zdma.c b/hw/dma/xlnx-zdma.c
75
index XXXXXXX..XXXXXXX 100644
76
--- a/hw/dma/xlnx-zdma.c
77
+++ b/hw/dma/xlnx-zdma.c
78
@@ -XXX,XX +XXX,XX @@ static bool zdma_load_descriptor(XlnxZDMA *s, uint64_t addr,
79
return false;
80
}
81
82
- descr->addr = address_space_ldq_le(s->dma_as, addr, s->attr, NULL);
83
- descr->size = address_space_ldl_le(s->dma_as, addr + 8, s->attr, NULL);
84
- descr->attr = address_space_ldl_le(s->dma_as, addr + 12, s->attr, NULL);
85
+ descr->addr = address_space_ldq_le(&s->dma_as, addr, s->attr, NULL);
86
+ descr->size = address_space_ldl_le(&s->dma_as, addr + 8, s->attr, NULL);
87
+ descr->attr = address_space_ldl_le(&s->dma_as, addr + 12, s->attr, NULL);
88
return true;
61
}
89
}
62
90
63
+static void versal_create_rtc(Versal *s, qemu_irq *pic)
91
@@ -XXX,XX +XXX,XX @@ static void zdma_update_descr_addr(XlnxZDMA *s, bool type,
64
+{
92
} else {
65
+ SysBusDevice *sbd;
93
addr = zdma_get_regaddr64(s, basereg);
66
+ MemoryRegion *mr;
94
addr += sizeof(s->dsc_dst);
95
- next = address_space_ldq_le(s->dma_as, addr, s->attr, NULL);
96
+ next = address_space_ldq_le(&s->dma_as, addr, s->attr, NULL);
97
}
98
99
zdma_put_regaddr64(s, basereg, next);
100
@@ -XXX,XX +XXX,XX @@ static void zdma_write_dst(XlnxZDMA *s, uint8_t *buf, uint32_t len)
101
}
102
}
103
104
- address_space_write(s->dma_as, s->dsc_dst.addr, s->attr, buf, dlen);
105
+ address_space_write(&s->dma_as, s->dsc_dst.addr, s->attr, buf, dlen);
106
if (burst_type == AXI_BURST_INCR) {
107
s->dsc_dst.addr += dlen;
108
}
109
@@ -XXX,XX +XXX,XX @@ static void zdma_process_descr(XlnxZDMA *s)
110
len = s->cfg.bus_width / 8;
111
}
112
} else {
113
- address_space_read(s->dma_as, src_addr, s->attr, s->buf, len);
114
+ address_space_read(&s->dma_as, src_addr, s->attr, s->buf, len);
115
if (burst_type == AXI_BURST_INCR) {
116
src_addr += len;
117
}
118
@@ -XXX,XX +XXX,XX @@ static void zdma_realize(DeviceState *dev, Error **errp)
119
XlnxZDMA *s = XLNX_ZDMA(dev);
120
unsigned int i;
121
122
+ if (!s->dma_mr) {
123
+ error_setg(errp, TYPE_XLNX_ZDMA " 'dma' link not set");
124
+ return;
125
+ }
126
+ address_space_init(&s->dma_as, s->dma_mr, "zdma-dma");
67
+
127
+
68
+ sysbus_init_child_obj(OBJECT(s), "rtc", &s->pmc.rtc, sizeof(s->pmc.rtc),
128
for (i = 0; i < ARRAY_SIZE(zdma_regs_info); ++i) {
69
+ TYPE_XLNX_ZYNQMP_RTC);
129
RegisterInfo *r = &s->regs_info[zdma_regs_info[i].addr / 4];
70
+ sbd = SYS_BUS_DEVICE(&s->pmc.rtc);
130
71
+ qdev_init_nofail(DEVICE(sbd));
131
@@ -XXX,XX +XXX,XX @@ static void zdma_realize(DeviceState *dev, Error **errp)
72
+
132
};
73
+ mr = sysbus_mmio_get_region(sbd, 0);
133
}
74
+ memory_region_add_subregion(&s->mr_ps, MM_PMC_RTC, mr);
134
75
+
135
- if (s->dma_mr) {
76
+ /*
136
- s->dma_as = g_malloc0(sizeof(AddressSpace));
77
+ * TODO: Connect the ALARM and SECONDS interrupts once our RTC model
137
- address_space_init(s->dma_as, s->dma_mr, NULL);
78
+ * supports them.
138
- } else {
79
+ */
139
- s->dma_as = &address_space_memory;
80
+ sysbus_connect_irq(sbd, 1, pic[VERSAL_RTC_APB_ERR_IRQ]);
140
- }
81
+}
141
s->attr = MEMTXATTRS_UNSPECIFIED;
82
+
142
}
83
/* This takes the board allocated linear DDR memory and creates aliases
84
* for each split DDR range/aperture on the Versal address map.
85
*/
86
@@ -XXX,XX +XXX,XX @@ static void versal_realize(DeviceState *dev, Error **errp)
87
versal_create_gems(s, pic);
88
versal_create_admas(s, pic);
89
versal_create_sds(s, pic);
90
+ versal_create_rtc(s, pic);
91
versal_map_ddr(s);
92
versal_unimp(s);
93
143
94
--
144
--
95
2.20.1
145
2.20.1
96
146
97
147
diff view generated by jsdifflib
1
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
1
From: Ani Sinha <ani@anisinha.ca>
2
2
3
Embed the APUs into the SoC type.
3
Since commit
4
36b79e3219d ("hw/acpi/Kconfig: Add missing Kconfig dependencies (build error)"),
5
ACPI_MEMORY_HOTPLUG and ACPI_NVDIMM is implicitly turned on when
6
ACPI_HW_REDUCED is selected. ACPI_HW_REDUCED is already enabled. No need to
7
turn on ACPI_MEMORY_HOTPLUG or ACPI_NVDIMM explicitly. This is a minor cleanup.
4
8
5
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Ani Sinha <ani@anisinha.ca>
6
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
10
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
11
Message-id: 20210819162637.518507-1-ani@anisinha.ca
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
10
Message-id: 20200427181649.26851-8-edgar.iglesias@gmail.com
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
13
---
13
include/hw/arm/xlnx-versal.h | 2 +-
14
hw/arm/Kconfig | 2 --
14
hw/arm/xlnx-versal-virt.c | 4 ++--
15
1 file changed, 2 deletions(-)
15
hw/arm/xlnx-versal.c | 19 +++++--------------
16
3 files changed, 8 insertions(+), 17 deletions(-)
17
16
18
diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
17
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
19
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
20
--- a/include/hw/arm/xlnx-versal.h
19
--- a/hw/arm/Kconfig
21
+++ b/include/hw/arm/xlnx-versal.h
20
+++ b/hw/arm/Kconfig
22
@@ -XXX,XX +XXX,XX @@ typedef struct Versal {
21
@@ -XXX,XX +XXX,XX @@ config ARM_VIRT
23
struct {
22
select ACPI_PCI
24
struct {
23
select MEM_DEVICE
25
MemoryRegion mr;
24
select DIMM
26
- ARMCPU *cpu[XLNX_VERSAL_NR_ACPUS];
25
- select ACPI_MEMORY_HOTPLUG
27
+ ARMCPU cpu[XLNX_VERSAL_NR_ACPUS];
26
select ACPI_HW_REDUCED
28
GICv3State gic;
27
- select ACPI_NVDIMM
29
} apu;
28
select ACPI_APEI
30
} fpd;
29
31
diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
30
config CHEETAH
32
index XXXXXXX..XXXXXXX 100644
33
--- a/hw/arm/xlnx-versal-virt.c
34
+++ b/hw/arm/xlnx-versal-virt.c
35
@@ -XXX,XX +XXX,XX @@ static void versal_virt_init(MachineState *machine)
36
s->binfo.get_dtb = versal_virt_get_dtb;
37
s->binfo.modify_dtb = versal_virt_modify_dtb;
38
if (machine->kernel_filename) {
39
- arm_load_kernel(s->soc.fpd.apu.cpu[0], machine, &s->binfo);
40
+ arm_load_kernel(&s->soc.fpd.apu.cpu[0], machine, &s->binfo);
41
} else {
42
- AddressSpace *as = arm_boot_address_space(s->soc.fpd.apu.cpu[0],
43
+ AddressSpace *as = arm_boot_address_space(&s->soc.fpd.apu.cpu[0],
44
&s->binfo);
45
/* Some boot-loaders (e.g u-boot) don't like blobs at address 0 (NULL).
46
* Offset things by 4K. */
47
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
48
index XXXXXXX..XXXXXXX 100644
49
--- a/hw/arm/xlnx-versal.c
50
+++ b/hw/arm/xlnx-versal.c
51
@@ -XXX,XX +XXX,XX @@ static void versal_create_apu_cpus(Versal *s)
52
53
for (i = 0; i < ARRAY_SIZE(s->fpd.apu.cpu); i++) {
54
Object *obj;
55
- char *name;
56
-
57
- obj = object_new(XLNX_VERSAL_ACPU_TYPE);
58
- if (!obj) {
59
- error_report("Unable to create apu.cpu[%d] of type %s",
60
- i, XLNX_VERSAL_ACPU_TYPE);
61
- exit(EXIT_FAILURE);
62
- }
63
-
64
- name = g_strdup_printf("apu-cpu[%d]", i);
65
- object_property_add_child(OBJECT(s), name, obj, &error_fatal);
66
- g_free(name);
67
68
+ object_initialize_child(OBJECT(s), "apu-cpu[*]",
69
+ &s->fpd.apu.cpu[i], sizeof(s->fpd.apu.cpu[i]),
70
+ XLNX_VERSAL_ACPU_TYPE, &error_abort, NULL);
71
+ obj = OBJECT(&s->fpd.apu.cpu[i]);
72
object_property_set_int(obj, s->cfg.psci_conduit,
73
"psci-conduit", &error_abort);
74
if (i) {
75
@@ -XXX,XX +XXX,XX @@ static void versal_create_apu_cpus(Versal *s)
76
object_property_set_link(obj, OBJECT(&s->fpd.apu.mr), "memory",
77
&error_abort);
78
object_property_set_bool(obj, true, "realized", &error_fatal);
79
- s->fpd.apu.cpu[i] = ARM_CPU(obj);
80
}
81
}
82
83
@@ -XXX,XX +XXX,XX @@ static void versal_create_apu_gic(Versal *s, qemu_irq *pic)
84
}
85
86
for (i = 0; i < nr_apu_cpus; i++) {
87
- DeviceState *cpudev = DEVICE(s->fpd.apu.cpu[i]);
88
+ DeviceState *cpudev = DEVICE(&s->fpd.apu.cpu[i]);
89
int ppibase = XLNX_VERSAL_NR_IRQS + i * GIC_INTERNAL + GIC_NR_SGIS;
90
qemu_irq maint_irq;
91
int ti;
92
--
31
--
93
2.20.1
32
2.20.1
94
33
95
34
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Andrew Jones <drjones@redhat.com>
2
2
3
MIDR_EL1 is a 64-bit system register with the top 32-bit being RES0.
3
Allow CPUs that support SVE to specify which SVE vector lengths they
4
Represent it in QEMU's ARMCPU struct with a uint64_t, not a
4
support by setting them in this bitmap. Currently only the 'max' and
5
uint32_t.
5
'host' CPU types supports SVE and 'host' requires KVM which obtains
6
its supported bitmap from the host. So, we only need to initialize the
7
bitmap for 'max' with TCG. And, since 'max' should support all SVE
8
vector lengths we simply fill the bitmap. Future CPU types may have
9
less trivial maps though.
6
10
7
This fixes an error when compiling with -Werror=conversion
11
Signed-off-by: Andrew Jones <drjones@redhat.com>
8
because we were manipulating the register value using a
12
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
9
local uint64_t variable:
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
14
Message-id: 20210823160647.34028-2-drjones@redhat.com
11
target/arm/cpu64.c: In function ‘aarch64_max_initfn’:
12
target/arm/cpu64.c:628:21: error: conversion from ‘uint64_t’ {aka ‘long unsigned int’} to ‘uint32_t’ {aka ‘unsigned int’} may change value [-Werror=conversion]
13
628 | cpu->midr = t;
14
| ^
15
16
and future-proofs us against a possible future architecture
17
change using some of the top 32 bits.
18
19
Suggested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
20
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
21
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
22
Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com>
23
Message-id: 20200428172634.29707-1-f4bug@amsat.org
24
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
25
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
26
---
16
---
27
target/arm/cpu.h | 2 +-
17
target/arm/cpu.h | 4 ++++
28
target/arm/cpu.c | 2 +-
18
target/arm/cpu64.c | 2 ++
29
2 files changed, 2 insertions(+), 2 deletions(-)
19
2 files changed, 6 insertions(+)
30
20
31
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
21
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
32
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
33
--- a/target/arm/cpu.h
23
--- a/target/arm/cpu.h
34
+++ b/target/arm/cpu.h
24
+++ b/target/arm/cpu.h
35
@@ -XXX,XX +XXX,XX @@ struct ARMCPU {
25
@@ -XXX,XX +XXX,XX @@ struct ARMCPU {
36
uint64_t id_aa64dfr0;
26
* While processing properties during initialization, corresponding
37
uint64_t id_aa64dfr1;
27
* sve_vq_init bits are set for bits in sve_vq_map that have been
38
} isar;
28
* set by properties.
39
- uint32_t midr;
29
+ *
40
+ uint64_t midr;
30
+ * Bits set in sve_vq_supported represent valid vector lengths for
41
uint32_t revidr;
31
+ * the CPU type.
42
uint32_t reset_fpsid;
32
*/
43
uint32_t ctr;
33
DECLARE_BITMAP(sve_vq_map, ARM_MAX_VQ);
44
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
34
DECLARE_BITMAP(sve_vq_init, ARM_MAX_VQ);
35
+ DECLARE_BITMAP(sve_vq_supported, ARM_MAX_VQ);
36
37
/* Generic timer counter frequency, in Hz */
38
uint64_t gt_cntfrq_hz;
39
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
45
index XXXXXXX..XXXXXXX 100644
40
index XXXXXXX..XXXXXXX 100644
46
--- a/target/arm/cpu.c
41
--- a/target/arm/cpu64.c
47
+++ b/target/arm/cpu.c
42
+++ b/target/arm/cpu64.c
48
@@ -XXX,XX +XXX,XX @@ static const ARMCPUInfo arm_cpus[] = {
43
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
49
static Property arm_cpu_properties[] = {
44
/* Default to PAUTH on, with the architected algorithm. */
50
DEFINE_PROP_BOOL("start-powered-off", ARMCPU, start_powered_off, false),
45
qdev_property_add_static(DEVICE(obj), &arm_cpu_pauth_property);
51
DEFINE_PROP_UINT32("psci-conduit", ARMCPU, psci_conduit, 0),
46
qdev_property_add_static(DEVICE(obj), &arm_cpu_pauth_impdef_property);
52
- DEFINE_PROP_UINT32("midr", ARMCPU, midr, 0),
47
+
53
+ DEFINE_PROP_UINT64("midr", ARMCPU, midr, 0),
48
+ bitmap_fill(cpu->sve_vq_supported, ARM_MAX_VQ);
54
DEFINE_PROP_UINT64("mp-affinity", ARMCPU,
49
}
55
mp_affinity, ARM64_AFFINITY_INVALID),
50
56
DEFINE_PROP_INT32("node-id", ARMCPU, node_id, CPU_UNSET_NUMA_NODE_ID),
51
aarch64_add_sve_properties(obj);
57
--
52
--
58
2.20.1
53
2.20.1
59
54
60
55
diff view generated by jsdifflib
1
From: Fredrik Strupe <fredrik@strupe.net>
1
From: Andrew Jones <drjones@redhat.com>
2
2
3
According to Arm ARM, VQDMULL is only valid when U=0, while having
3
bitmap_clear() only clears the given range. While the given
4
U=1 is unallocated.
4
range should be sufficient in this case we might as well be
5
100% sure all bits are zeroed by using bitmap_zero().
5
6
6
Signed-off-by: Fredrik Strupe <fredrik@strupe.net>
7
Signed-off-by: Andrew Jones <drjones@redhat.com>
7
Fixes: 695272dcb976 ("target-arm: Handle UNDEF cases for Neon 3-regs-different-widths")
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Message-id: 20210823160647.34028-3-drjones@redhat.com
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
12
---
11
target/arm/translate.c | 2 +-
13
target/arm/kvm64.c | 2 +-
12
1 file changed, 1 insertion(+), 1 deletion(-)
14
1 file changed, 1 insertion(+), 1 deletion(-)
13
15
14
diff --git a/target/arm/translate.c b/target/arm/translate.c
16
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
15
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/translate.c
18
--- a/target/arm/kvm64.c
17
+++ b/target/arm/translate.c
19
+++ b/target/arm/kvm64.c
18
@@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
20
@@ -XXX,XX +XXX,XX @@ void kvm_arm_sve_get_vls(CPUState *cs, unsigned long *map)
19
{0, 0, 0, 0}, /* VMLSL */
21
uint32_t vq = 0;
20
{0, 0, 0, 9}, /* VQDMLSL */
22
int i, j;
21
{0, 0, 0, 0}, /* Integer VMULL */
23
22
- {0, 0, 0, 1}, /* VQDMULL */
24
- bitmap_clear(map, 0, ARM_MAX_VQ);
23
+ {0, 0, 0, 9}, /* VQDMULL */
25
+ bitmap_zero(map, ARM_MAX_VQ);
24
{0, 0, 0, 0xa}, /* Polynomial VMULL */
26
25
{0, 0, 0, 7}, /* Reserved: always UNDEF */
27
/*
26
};
28
* KVM ensures all host CPUs support the same set of vector lengths.
27
--
29
--
28
2.20.1
30
2.20.1
29
31
30
32
diff view generated by jsdifflib
1
Convert the VFM[AS]L (vector) insns to decodetree. This is the last
1
From: Andrew Jones <drjones@redhat.com>
2
insn in the legacy decoder for the 3same_ext group, so we can
3
delete the legacy decoder function for the group entirely.
4
2
5
Note that in disas_thumb2_insn() the parts of this encoding space
3
Now that we have an ARMCPU member sve_vq_supported we no longer
6
where the decodetree decoder returns false will correctly be directed
4
need the local kvm_supported bitmap for KVM's supported vector
7
to illegal_op by the "(insn & (1 << 28))" check so they won't fall
5
lengths.
8
into disas_coproc_insn() by mistake.
9
6
7
Signed-off-by: Andrew Jones <drjones@redhat.com>
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Message-id: 20210823160647.34028-4-drjones@redhat.com
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
12
Message-id: 20200430181003.21682-8-peter.maydell@linaro.org
13
---
12
---
14
target/arm/neon-shared.decode | 6 +++
13
target/arm/cpu64.c | 19 +++++++++++--------
15
target/arm/translate-neon.inc.c | 31 +++++++++++
14
1 file changed, 11 insertions(+), 8 deletions(-)
16
target/arm/translate.c | 92 +--------------------------------
17
3 files changed, 38 insertions(+), 91 deletions(-)
18
15
19
diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode
16
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
20
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
21
--- a/target/arm/neon-shared.decode
18
--- a/target/arm/cpu64.c
22
+++ b/target/arm/neon-shared.decode
19
+++ b/target/arm/cpu64.c
23
@@ -XXX,XX +XXX,XX @@ VCADD 1111 110 rot:1 1 . 0 size:1 .... .... 1000 . q:1 . 0 .... \
20
@@ -XXX,XX +XXX,XX @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp)
24
# VUDOT and VSDOT
21
* any of the above. Finally, if SVE is not disabled, then at least one
25
VDOT 1111 110 00 . 10 .... .... 1101 . q:1 . u:1 .... \
22
* vector length must be enabled.
26
vm=%vm_dp vn=%vn_dp vd=%vd_dp
23
*/
27
+
24
- DECLARE_BITMAP(kvm_supported, ARM_MAX_VQ);
28
+# VFM[AS]L
25
DECLARE_BITMAP(tmp, ARM_MAX_VQ);
29
+VFML 1111 110 0 s:1 . 10 .... .... 1000 . 0 . 1 .... \
26
uint32_t vq, max_vq = 0;
30
+ vm=%vm_sp vn=%vn_sp vd=%vd_dp q=0
27
31
+VFML 1111 110 0 s:1 . 10 .... .... 1000 . 1 . 1 .... \
28
- /* Collect the set of vector lengths supported by KVM. */
32
+ vm=%vm_dp vn=%vn_dp vd=%vd_dp q=1
29
- bitmap_zero(kvm_supported, ARM_MAX_VQ);
33
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
30
+ /*
34
index XXXXXXX..XXXXXXX 100644
31
+ * CPU models specify a set of supported vector lengths which are
35
--- a/target/arm/translate-neon.inc.c
32
+ * enabled by default. Attempting to enable any vector length not set
36
+++ b/target/arm/translate-neon.inc.c
33
+ * in the supported bitmap results in an error. When KVM is enabled we
37
@@ -XXX,XX +XXX,XX @@ static bool trans_VDOT(DisasContext *s, arg_VDOT *a)
34
+ * fetch the supported bitmap from the host.
38
opr_sz, opr_sz, 0, fn_gvec);
35
+ */
39
return true;
36
if (kvm_enabled() && kvm_arm_sve_supported()) {
40
}
37
- kvm_arm_sve_get_vls(CPU(cpu), kvm_supported);
41
+
38
+ kvm_arm_sve_get_vls(CPU(cpu), cpu->sve_vq_supported);
42
+static bool trans_VFML(DisasContext *s, arg_VFML *a)
39
} else if (kvm_enabled()) {
43
+{
40
assert(!cpu_isar_feature(aa64_sve, cpu));
44
+ int opr_sz;
41
}
45
+
42
@@ -XXX,XX +XXX,XX @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp)
46
+ if (!dc_isar_feature(aa32_fhm, s)) {
43
* For KVM we have to automatically enable all supported unitialized
47
+ return false;
44
* lengths, even when the smaller lengths are not all powers-of-two.
48
+ }
45
*/
49
+
46
- bitmap_andnot(tmp, kvm_supported, cpu->sve_vq_init, max_vq);
50
+ /* UNDEF accesses to D16-D31 if they don't exist. */
47
+ bitmap_andnot(tmp, cpu->sve_vq_supported, cpu->sve_vq_init, max_vq);
51
+ if (!dc_isar_feature(aa32_simd_r32, s) &&
48
bitmap_or(cpu->sve_vq_map, cpu->sve_vq_map, tmp, max_vq);
52
+ (a->vd & 0x10)) {
49
} else {
53
+ return false;
50
/* Propagate enabled bits down through required powers-of-two. */
54
+ }
51
@@ -XXX,XX +XXX,XX @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp)
55
+
52
/* Disabling a supported length disables all larger lengths. */
56
+ if (a->vd & a->q) {
53
for (vq = 1; vq <= ARM_MAX_VQ; ++vq) {
57
+ return false;
54
if (test_bit(vq - 1, cpu->sve_vq_init) &&
58
+ }
55
- test_bit(vq - 1, kvm_supported)) {
59
+
56
+ test_bit(vq - 1, cpu->sve_vq_supported)) {
60
+ if (!vfp_access_check(s)) {
57
break;
61
+ return true;
62
+ }
63
+
64
+ opr_sz = (1 + a->q) * 8;
65
+ tcg_gen_gvec_3_ptr(vfp_reg_offset(1, a->vd),
66
+ vfp_reg_offset(a->q, a->vn),
67
+ vfp_reg_offset(a->q, a->vm),
68
+ cpu_env, opr_sz, opr_sz, a->s, /* is_2 == 0 */
69
+ gen_helper_gvec_fmlal_a32);
70
+ return true;
71
+}
72
diff --git a/target/arm/translate.c b/target/arm/translate.c
73
index XXXXXXX..XXXXXXX 100644
74
--- a/target/arm/translate.c
75
+++ b/target/arm/translate.c
76
@@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
77
return 0;
78
}
79
80
-/* Advanced SIMD three registers of the same length extension.
81
- * 31 25 23 22 20 16 12 11 10 9 8 3 0
82
- * +---------------+-----+---+-----+----+----+---+----+---+----+---------+----+
83
- * | 1 1 1 1 1 1 0 | op1 | D | op2 | Vn | Vd | 1 | o3 | 0 | o4 | N Q M U | Vm |
84
- * +---------------+-----+---+-----+----+----+---+----+---+----+---------+----+
85
- */
86
-static int disas_neon_insn_3same_ext(DisasContext *s, uint32_t insn)
87
-{
88
- gen_helper_gvec_3 *fn_gvec = NULL;
89
- gen_helper_gvec_3_ptr *fn_gvec_ptr = NULL;
90
- int rd, rn, rm, opr_sz;
91
- int data = 0;
92
- int off_rn, off_rm;
93
- bool is_long = false, q = extract32(insn, 6, 1);
94
- bool ptr_is_env = false;
95
-
96
- if ((insn & 0xff300f10) == 0xfc200810) {
97
- /* VFM[AS]L -- 1111 1100 S.10 .... .... 1000 .Q.1 .... */
98
- int is_s = extract32(insn, 23, 1);
99
- if (!dc_isar_feature(aa32_fhm, s)) {
100
- return 1;
101
- }
102
- is_long = true;
103
- data = is_s; /* is_2 == 0 */
104
- fn_gvec_ptr = gen_helper_gvec_fmlal_a32;
105
- ptr_is_env = true;
106
- } else {
107
- return 1;
108
- }
109
-
110
- VFP_DREG_D(rd, insn);
111
- if (rd & q) {
112
- return 1;
113
- }
114
- if (q || !is_long) {
115
- VFP_DREG_N(rn, insn);
116
- VFP_DREG_M(rm, insn);
117
- if ((rn | rm) & q & !is_long) {
118
- return 1;
119
- }
120
- off_rn = vfp_reg_offset(1, rn);
121
- off_rm = vfp_reg_offset(1, rm);
122
- } else {
123
- rn = VFP_SREG_N(insn);
124
- rm = VFP_SREG_M(insn);
125
- off_rn = vfp_reg_offset(0, rn);
126
- off_rm = vfp_reg_offset(0, rm);
127
- }
128
-
129
- if (s->fp_excp_el) {
130
- gen_exception_insn(s, s->pc_curr, EXCP_UDEF,
131
- syn_simd_access_trap(1, 0xe, false), s->fp_excp_el);
132
- return 0;
133
- }
134
- if (!s->vfp_enabled) {
135
- return 1;
136
- }
137
-
138
- opr_sz = (1 + q) * 8;
139
- if (fn_gvec_ptr) {
140
- TCGv_ptr ptr;
141
- if (ptr_is_env) {
142
- ptr = cpu_env;
143
- } else {
144
- ptr = get_fpstatus_ptr(1);
145
- }
146
- tcg_gen_gvec_3_ptr(vfp_reg_offset(1, rd), off_rn, off_rm, ptr,
147
- opr_sz, opr_sz, data, fn_gvec_ptr);
148
- if (!ptr_is_env) {
149
- tcg_temp_free_ptr(ptr);
150
- }
151
- } else {
152
- tcg_gen_gvec_3_ool(vfp_reg_offset(1, rd), off_rn, off_rm,
153
- opr_sz, opr_sz, data, fn_gvec);
154
- }
155
- return 0;
156
-}
157
-
158
/* Advanced SIMD two registers and a scalar extension.
159
* 31 24 23 22 20 16 12 11 10 9 8 3 0
160
* +-----------------+----+---+----+----+----+---+----+---+----+---------+----+
161
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
162
}
163
}
58
}
164
}
59
}
165
- } else if ((insn & 0x0e000a00) == 0x0c000800
60
max_vq = vq <= ARM_MAX_VQ ? vq - 1 : ARM_MAX_VQ;
166
- && arm_dc_feature(s, ARM_FEATURE_V8)) {
61
- bitmap_andnot(cpu->sve_vq_map, kvm_supported,
167
- if (disas_neon_insn_3same_ext(s, insn)) {
62
+ bitmap_andnot(cpu->sve_vq_map, cpu->sve_vq_supported,
168
- goto illegal_op;
63
cpu->sve_vq_init, max_vq);
169
- }
64
if (max_vq == 0 || bitmap_empty(cpu->sve_vq_map, max_vq)) {
170
- return;
65
error_setg(errp, "cannot disable sve%d", vq * 128);
171
} else if ((insn & 0x0f000a00) == 0x0e000800
66
@@ -XXX,XX +XXX,XX @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp)
172
&& arm_dc_feature(s, ARM_FEATURE_V8)) {
67
173
if (disas_neon_insn_2reg_scalar_ext(s, insn)) {
68
if (kvm_enabled()) {
174
@@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn)
69
/* Ensure the set of lengths matches what KVM supports. */
175
}
70
- bitmap_xor(tmp, cpu->sve_vq_map, kvm_supported, max_vq);
176
break;
71
+ bitmap_xor(tmp, cpu->sve_vq_map, cpu->sve_vq_supported, max_vq);
177
}
72
if (!bitmap_empty(tmp, max_vq)) {
178
- if ((insn & 0xfe000a00) == 0xfc000800
73
vq = find_last_bit(tmp, max_vq) + 1;
179
+ if ((insn & 0xff000a00) == 0xfe000800
74
if (test_bit(vq - 1, cpu->sve_vq_map)) {
180
&& arm_dc_feature(s, ARM_FEATURE_V8)) {
181
/* The Thumb2 and ARM encodings are identical. */
182
- if (disas_neon_insn_3same_ext(s, insn)) {
183
- goto illegal_op;
184
- }
185
- } else if ((insn & 0xff000a00) == 0xfe000800
186
- && arm_dc_feature(s, ARM_FEATURE_V8)) {
187
- /* The Thumb2 and ARM encodings are identical. */
188
if (disas_neon_insn_2reg_scalar_ext(s, insn)) {
189
goto illegal_op;
190
}
191
--
75
--
192
2.20.1
76
2.20.1
193
77
194
78
diff view generated by jsdifflib
1
In aarch64_max_initfn() we update both 32-bit and 64-bit ID
1
From: Andrew Jones <drjones@redhat.com>
2
registers. The intended pattern is that for 64-bit ID registers we
3
use FIELD_DP64 and the uint64_t 't' register, while 32-bit ID
4
registers use FIELD_DP32 and the uint32_t 'u' register. For
5
ID_AA64DFR0 we accidentally used 'u', meaning that the top 32 bits of
6
this 64-bit ID register would end up always zero. Luckily at the
7
moment that's what they should be anyway, so this bug has no visible
8
effects.
9
2
10
Use the right-sized variable.
3
Future CPU types may specify which vector lengths are supported.
4
We can apply nearly the same logic to validate those lengths
5
as we do for KVM's supported vector lengths. We merge the code
6
where we can, but unfortunately can't completely merge it because
7
KVM requires all vector lengths, power-of-two or not, smaller than
8
the maximum enabled length to also be enabled. The architecture
9
only requires all the power-of-two lengths, though, so TCG will
10
only enforce that.
11
11
12
Fixes: 3bec78447a958d481991
12
Signed-off-by: Andrew Jones <drjones@redhat.com>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Message-id: 20210823160647.34028-5-drjones@redhat.com
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com>
15
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
16
Message-id: 20200423110915.10527-1-peter.maydell@linaro.org
17
---
16
---
18
target/arm/cpu64.c | 6 +++---
17
target/arm/cpu64.c | 101 ++++++++++++++++++++-------------------------
19
1 file changed, 3 insertions(+), 3 deletions(-)
18
1 file changed, 45 insertions(+), 56 deletions(-)
20
19
21
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
20
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
22
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
23
--- a/target/arm/cpu64.c
22
--- a/target/arm/cpu64.c
24
+++ b/target/arm/cpu64.c
23
+++ b/target/arm/cpu64.c
25
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
24
@@ -XXX,XX +XXX,XX @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp)
26
u = FIELD_DP32(u, ID_MMFR4, XNX, 1); /* TTS2UXN */
25
break;
27
cpu->isar.id_mmfr4 = u;
26
}
28
27
}
29
- u = cpu->isar.id_aa64dfr0;
28
- max_vq = vq <= ARM_MAX_VQ ? vq - 1 : ARM_MAX_VQ;
30
- u = FIELD_DP64(u, ID_AA64DFR0, PMUVER, 5); /* v8.4-PMU */
29
- bitmap_andnot(cpu->sve_vq_map, cpu->sve_vq_supported,
31
- cpu->isar.id_aa64dfr0 = u;
30
- cpu->sve_vq_init, max_vq);
32
+ t = cpu->isar.id_aa64dfr0;
31
- if (max_vq == 0 || bitmap_empty(cpu->sve_vq_map, max_vq)) {
33
+ t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 5); /* v8.4-PMU */
32
- error_setg(errp, "cannot disable sve%d", vq * 128);
34
+ cpu->isar.id_aa64dfr0 = t;
33
- error_append_hint(errp, "Disabling sve%d results in all "
35
34
- "vector lengths being disabled.\n",
36
u = cpu->isar.id_dfr0;
35
- vq * 128);
37
u = FIELD_DP32(u, ID_DFR0, PERFMON, 5); /* v8.4-PMU */
36
- error_append_hint(errp, "With SVE enabled, at least one "
37
- "vector length must be enabled.\n");
38
- return;
39
- }
40
} else {
41
/* Disabling a power-of-two disables all larger lengths. */
42
- if (test_bit(0, cpu->sve_vq_init)) {
43
- error_setg(errp, "cannot disable sve128");
44
- error_append_hint(errp, "Disabling sve128 results in all "
45
- "vector lengths being disabled.\n");
46
- error_append_hint(errp, "With SVE enabled, at least one "
47
- "vector length must be enabled.\n");
48
- return;
49
- }
50
- for (vq = 2; vq <= ARM_MAX_VQ; vq <<= 1) {
51
+ for (vq = 1; vq <= ARM_MAX_VQ; vq <<= 1) {
52
if (test_bit(vq - 1, cpu->sve_vq_init)) {
53
break;
54
}
55
}
56
- max_vq = vq <= ARM_MAX_VQ ? vq - 1 : ARM_MAX_VQ;
57
- bitmap_complement(cpu->sve_vq_map, cpu->sve_vq_init, max_vq);
58
+ }
59
+
60
+ max_vq = vq <= ARM_MAX_VQ ? vq - 1 : ARM_MAX_VQ;
61
+ bitmap_andnot(cpu->sve_vq_map, cpu->sve_vq_supported,
62
+ cpu->sve_vq_init, max_vq);
63
+ if (max_vq == 0 || bitmap_empty(cpu->sve_vq_map, max_vq)) {
64
+ error_setg(errp, "cannot disable sve%d", vq * 128);
65
+ error_append_hint(errp, "Disabling sve%d results in all "
66
+ "vector lengths being disabled.\n",
67
+ vq * 128);
68
+ error_append_hint(errp, "With SVE enabled, at least one "
69
+ "vector length must be enabled.\n");
70
+ return;
71
}
72
73
max_vq = find_last_bit(cpu->sve_vq_map, max_vq) + 1;
74
@@ -XXX,XX +XXX,XX @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp)
75
assert(max_vq != 0);
76
bitmap_clear(cpu->sve_vq_map, max_vq, ARM_MAX_VQ - max_vq);
77
78
- if (kvm_enabled()) {
79
- /* Ensure the set of lengths matches what KVM supports. */
80
- bitmap_xor(tmp, cpu->sve_vq_map, cpu->sve_vq_supported, max_vq);
81
- if (!bitmap_empty(tmp, max_vq)) {
82
- vq = find_last_bit(tmp, max_vq) + 1;
83
- if (test_bit(vq - 1, cpu->sve_vq_map)) {
84
- if (cpu->sve_max_vq) {
85
- error_setg(errp, "cannot set sve-max-vq=%d",
86
- cpu->sve_max_vq);
87
- error_append_hint(errp, "This KVM host does not support "
88
- "the vector length %d-bits.\n",
89
- vq * 128);
90
- error_append_hint(errp, "It may not be possible to use "
91
- "sve-max-vq with this KVM host. Try "
92
- "using only sve<N> properties.\n");
93
- } else {
94
- error_setg(errp, "cannot enable sve%d", vq * 128);
95
- error_append_hint(errp, "This KVM host does not support "
96
- "the vector length %d-bits.\n",
97
- vq * 128);
98
- }
99
+ /* Ensure the set of lengths matches what is supported. */
100
+ bitmap_xor(tmp, cpu->sve_vq_map, cpu->sve_vq_supported, max_vq);
101
+ if (!bitmap_empty(tmp, max_vq)) {
102
+ vq = find_last_bit(tmp, max_vq) + 1;
103
+ if (test_bit(vq - 1, cpu->sve_vq_map)) {
104
+ if (cpu->sve_max_vq) {
105
+ error_setg(errp, "cannot set sve-max-vq=%d", cpu->sve_max_vq);
106
+ error_append_hint(errp, "This CPU does not support "
107
+ "the vector length %d-bits.\n", vq * 128);
108
+ error_append_hint(errp, "It may not be possible to use "
109
+ "sve-max-vq with this CPU. Try "
110
+ "using only sve<N> properties.\n");
111
} else {
112
+ error_setg(errp, "cannot enable sve%d", vq * 128);
113
+ error_append_hint(errp, "This CPU does not support "
114
+ "the vector length %d-bits.\n", vq * 128);
115
+ }
116
+ return;
117
+ } else {
118
+ if (kvm_enabled()) {
119
error_setg(errp, "cannot disable sve%d", vq * 128);
120
error_append_hint(errp, "The KVM host requires all "
121
"supported vector lengths smaller "
122
"than %d bits to also be enabled.\n",
123
max_vq * 128);
124
- }
125
- return;
126
- }
127
- } else {
128
- /* Ensure all required powers-of-two are enabled. */
129
- for (vq = pow2floor(max_vq); vq >= 1; vq >>= 1) {
130
- if (!test_bit(vq - 1, cpu->sve_vq_map)) {
131
- error_setg(errp, "cannot disable sve%d", vq * 128);
132
- error_append_hint(errp, "sve%d is required as it "
133
- "is a power-of-two length smaller than "
134
- "the maximum, sve%d\n",
135
- vq * 128, max_vq * 128);
136
return;
137
+ } else {
138
+ /* Ensure all required powers-of-two are enabled. */
139
+ for (vq = pow2floor(max_vq); vq >= 1; vq >>= 1) {
140
+ if (!test_bit(vq - 1, cpu->sve_vq_map)) {
141
+ error_setg(errp, "cannot disable sve%d", vq * 128);
142
+ error_append_hint(errp, "sve%d is required as it "
143
+ "is a power-of-two length smaller "
144
+ "than the maximum, sve%d\n",
145
+ vq * 128, max_vq * 128);
146
+ return;
147
+ }
148
+ }
149
}
150
}
151
}
38
--
152
--
39
2.20.1
153
2.20.1
40
154
41
155
diff view generated by jsdifflib
1
We're going to want at least some of the NeonGen* typedefs
1
Do a basic conversion of the acpi_cpu_hotplug spec document to rST.
2
for the refactored 32-bit Neon decoder, so move them all
3
to translate.h since it makes more sense to keep them in
4
one group.
5
2
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
4
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
8
Message-id: 20200430181003.21682-23-peter.maydell@linaro.org
5
Message-id: 20210727170414.3368-2-peter.maydell@linaro.org
9
---
6
---
10
target/arm/translate.h | 17 +++++++++++++++++
7
docs/specs/acpi_cpu_hotplug.rst | 235 ++++++++++++++++++++++++++++++++
11
target/arm/translate-a64.c | 17 -----------------
8
docs/specs/acpi_cpu_hotplug.txt | 160 ----------------------
12
2 files changed, 17 insertions(+), 17 deletions(-)
9
docs/specs/index.rst | 1 +
10
3 files changed, 236 insertions(+), 160 deletions(-)
11
create mode 100644 docs/specs/acpi_cpu_hotplug.rst
12
delete mode 100644 docs/specs/acpi_cpu_hotplug.txt
13
13
14
diff --git a/target/arm/translate.h b/target/arm/translate.h
14
diff --git a/docs/specs/acpi_cpu_hotplug.rst b/docs/specs/acpi_cpu_hotplug.rst
15
new file mode 100644
16
index XXXXXXX..XXXXXXX
17
--- /dev/null
18
+++ b/docs/specs/acpi_cpu_hotplug.rst
19
@@ -XXX,XX +XXX,XX @@
20
+QEMU<->ACPI BIOS CPU hotplug interface
21
+======================================
22
+
23
+QEMU supports CPU hotplug via ACPI. This document
24
+describes the interface between QEMU and the ACPI BIOS.
25
+
26
+ACPI BIOS GPE.2 handler is dedicated for notifying OS about CPU hot-add
27
+and hot-remove events.
28
+
29
+
30
+Legacy ACPI CPU hotplug interface registers
31
+-------------------------------------------
32
+
33
+CPU present bitmap for:
34
+
35
+- ICH9-LPC (IO port 0x0cd8-0xcf7, 1-byte access)
36
+- PIIX-PM (IO port 0xaf00-0xaf1f, 1-byte access)
37
+- One bit per CPU. Bit position reflects corresponding CPU APIC ID. Read-only.
38
+- The first DWORD in bitmap is used in write mode to switch from legacy
39
+ to modern CPU hotplug interface, write 0 into it to do switch.
40
+
41
+QEMU sets corresponding CPU bit on hot-add event and issues SCI
42
+with GPE.2 event set. CPU present map is read by ACPI BIOS GPE.2 handler
43
+to notify OS about CPU hot-add events. CPU hot-remove isn't supported.
44
+
45
+
46
+Modern ACPI CPU hotplug interface registers
47
+-------------------------------------------
48
+
49
+Register block base address:
50
+
51
+- ICH9-LPC IO port 0x0cd8
52
+- PIIX-PM IO port 0xaf00
53
+
54
+Register block size:
55
+
56
+- ACPI_CPU_HOTPLUG_REG_LEN = 12
57
+
58
+All accesses to registers described below, imply little-endian byte order.
59
+
60
+Reserved registers behavior:
61
+
62
+- write accesses are ignored
63
+- read accesses return all bits set to 0.
64
+
65
+The last stored value in 'CPU selector' must refer to a possible CPU, otherwise
66
+
67
+- reads from any register return 0
68
+- writes to any other register are ignored until valid value is stored into it
69
+
70
+On QEMU start, 'CPU selector' is initialized to a valid value, on reset it
71
+keeps the current value.
72
+
73
+Read access behavior
74
+^^^^^^^^^^^^^^^^^^^^
75
+
76
+offset [0x0-0x3]
77
+ Command data 2: (DWORD access)
78
+
79
+ If value last stored in 'Command field' is:
80
+
81
+ 0:
82
+ reads as 0x0
83
+ 3:
84
+ upper 32 bits of architecture specific CPU ID value
85
+ other values:
86
+ reserved
87
+
88
+offset [0x4]
89
+ CPU device status fields: (1 byte access)
90
+
91
+ bits:
92
+
93
+ 0:
94
+ Device is enabled and may be used by guest
95
+ 1:
96
+ Device insert event, used to distinguish device for which
97
+ no device check event to OSPM was issued.
98
+ It's valid only when bit 0 is set.
99
+ 2:
100
+ Device remove event, used to distinguish device for which
101
+ no device eject request to OSPM was issued. Firmware must
102
+ ignore this bit.
103
+ 3:
104
+ reserved and should be ignored by OSPM
105
+ 4:
106
+ if set to 1, OSPM requests firmware to perform device eject.
107
+ 5-7:
108
+ reserved and should be ignored by OSPM
109
+
110
+offset [0x5-0x7]
111
+ reserved
112
+
113
+offset [0x8]
114
+ Command data: (DWORD access)
115
+
116
+ If value last stored in 'Command field' is one of:
117
+
118
+ 0:
119
+ contains 'CPU selector' value of a CPU with pending event[s]
120
+ 3:
121
+ lower 32 bits of architecture specific CPU ID value
122
+ (in x86 case: APIC ID)
123
+ otherwise:
124
+ contains 0
125
+
126
+Write access behavior
127
+^^^^^^^^^^^^^^^^^^^^^
128
+
129
+offset [0x0-0x3]
130
+ CPU selector: (DWORD access)
131
+
132
+ Selects active CPU device. All following accesses to other
133
+ registers will read/store data from/to selected CPU.
134
+ Valid values: [0 .. max_cpus)
135
+
136
+offset [0x4]
137
+ CPU device control fields: (1 byte access)
138
+
139
+ bits:
140
+
141
+ 0:
142
+ reserved, OSPM must clear it before writing to register.
143
+ 1:
144
+ if set to 1 clears device insert event, set by OSPM
145
+ after it has emitted device check event for the
146
+ selected CPU device
147
+ 2:
148
+ if set to 1 clears device remove event, set by OSPM
149
+ after it has emitted device eject request for the
150
+ selected CPU device.
151
+ 3:
152
+ if set to 1 initiates device eject, set by OSPM when it
153
+ triggers CPU device removal and calls _EJ0 method or by firmware
154
+ when bit #4 is set. In case bit #4 were set, it's cleared as
155
+ part of device eject.
156
+ 4:
157
+ if set to 1, OSPM hands over device eject to firmware.
158
+ Firmware shall issue device eject request as described above
159
+ (bit #3) and OSPM should not touch device eject bit (#3) in case
160
+ it's asked firmware to perform CPU device eject.
161
+ 5-7:
162
+ reserved, OSPM must clear them before writing to register
163
+
164
+offset[0x5]
165
+ Command field: (1 byte access)
166
+
167
+ value:
168
+
169
+ 0:
170
+ selects a CPU device with inserting/removing events and
171
+ following reads from 'Command data' register return
172
+ selected CPU ('CPU selector' value).
173
+ If no CPU with events found, the current 'CPU selector' doesn't
174
+ change and corresponding insert/remove event flags are not modified.
175
+
176
+ 1:
177
+ following writes to 'Command data' register set OST event
178
+ register in QEMU
179
+ 2:
180
+ following writes to 'Command data' register set OST status
181
+ register in QEMU
182
+ 3:
183
+ following reads from 'Command data' and 'Command data 2' return
184
+ architecture specific CPU ID value for currently selected CPU.
185
+ other values:
186
+ reserved
187
+
188
+offset [0x6-0x7]
189
+ reserved
190
+
191
+offset [0x8]
192
+ Command data: (DWORD access)
193
+
194
+ If last stored 'Command field' value is:
195
+
196
+ 1:
197
+ stores value into OST event register
198
+ 2:
199
+ stores value into OST status register, triggers
200
+ ACPI_DEVICE_OST QMP event from QEMU to external applications
201
+ with current values of OST event and status registers.
202
+ other values:
203
+ reserved
204
+
205
+Typical usecases
206
+----------------
207
+
208
+(x86) Detecting and enabling modern CPU hotplug interface
209
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
210
+
211
+QEMU starts with legacy CPU hotplug interface enabled. Detecting and
212
+switching to modern interface is based on the 2 legacy CPU hotplug features:
213
+
214
+#. Writes into CPU bitmap are ignored.
215
+#. CPU bitmap always has bit #0 set, corresponding to boot CPU.
216
+
217
+Use following steps to detect and enable modern CPU hotplug interface:
218
+
219
+#. Store 0x0 to the 'CPU selector' register, attempting to switch to modern mode
220
+#. Store 0x0 to the 'CPU selector' register, to ensure valid selector value
221
+#. Store 0x0 to the 'Command field' register
222
+#. Read the 'Command data 2' register.
223
+ If read value is 0x0, the modern interface is enabled.
224
+ Otherwise legacy or no CPU hotplug interface available
225
+
226
+Get a cpu with pending event
227
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
228
+
229
+#. Store 0x0 to the 'CPU selector' register.
230
+#. Store 0x0 to the 'Command field' register.
231
+#. Read the 'CPU device status fields' register.
232
+#. If both bit #1 and bit #2 are clear in the value read, there is no CPU
233
+ with a pending event and selected CPU remains unchanged.
234
+#. Otherwise, read the 'Command data' register. The value read is the
235
+ selector of the CPU with the pending event (which is already selected).
236
+
237
+Enumerate CPUs present/non present CPUs
238
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
239
+
240
+#. Set the present CPU count to 0.
241
+#. Set the iterator to 0.
242
+#. Store 0x0 to the 'CPU selector' register, to ensure that it's in
243
+ a valid state and that access to other registers won't be ignored.
244
+#. Store 0x0 to the 'Command field' register to make 'Command data'
245
+ register return 'CPU selector' value of selected CPU
246
+#. Read the 'CPU device status fields' register.
247
+#. If bit #0 is set, increment the present CPU count.
248
+#. Increment the iterator.
249
+#. Store the iterator to the 'CPU selector' register.
250
+#. Read the 'Command data' register.
251
+#. If the value read is not zero, goto 05.
252
+#. Otherwise store 0x0 to the 'CPU selector' register, to put it
253
+ into a valid state and exit.
254
+ The iterator at this point equals "max_cpus".
255
diff --git a/docs/specs/acpi_cpu_hotplug.txt b/docs/specs/acpi_cpu_hotplug.txt
256
deleted file mode 100644
257
index XXXXXXX..XXXXXXX
258
--- a/docs/specs/acpi_cpu_hotplug.txt
259
+++ /dev/null
260
@@ -XXX,XX +XXX,XX @@
261
-QEMU<->ACPI BIOS CPU hotplug interface
262
---------------------------------------
263
-
264
-QEMU supports CPU hotplug via ACPI. This document
265
-describes the interface between QEMU and the ACPI BIOS.
266
-
267
-ACPI BIOS GPE.2 handler is dedicated for notifying OS about CPU hot-add
268
-and hot-remove events.
269
-
270
-============================================
271
-Legacy ACPI CPU hotplug interface registers:
272
---------------------------------------------
273
-CPU present bitmap for:
274
- ICH9-LPC (IO port 0x0cd8-0xcf7, 1-byte access)
275
- PIIX-PM (IO port 0xaf00-0xaf1f, 1-byte access)
276
- One bit per CPU. Bit position reflects corresponding CPU APIC ID. Read-only.
277
- The first DWORD in bitmap is used in write mode to switch from legacy
278
- to modern CPU hotplug interface, write 0 into it to do switch.
279
----------------------------------------------------------------
280
-QEMU sets corresponding CPU bit on hot-add event and issues SCI
281
-with GPE.2 event set. CPU present map is read by ACPI BIOS GPE.2 handler
282
-to notify OS about CPU hot-add events. CPU hot-remove isn't supported.
283
-
284
-=====================================
285
-Modern ACPI CPU hotplug interface registers:
286
--------------------------------------
287
-Register block base address:
288
- ICH9-LPC IO port 0x0cd8
289
- PIIX-PM IO port 0xaf00
290
-Register block size:
291
- ACPI_CPU_HOTPLUG_REG_LEN = 12
292
-
293
-All accesses to registers described below, imply little-endian byte order.
294
-
295
-Reserved resisters behavior:
296
- - write accesses are ignored
297
- - read accesses return all bits set to 0.
298
-
299
-The last stored value in 'CPU selector' must refer to a possible CPU, otherwise
300
- - reads from any register return 0
301
- - writes to any other register are ignored until valid value is stored into it
302
-On QEMU start, 'CPU selector' is initialized to a valid value, on reset it
303
-keeps the current value.
304
-
305
-read access:
306
- offset:
307
- [0x0-0x3] Command data 2: (DWORD access)
308
- if value last stored in 'Command field':
309
- 0: reads as 0x0
310
- 3: upper 32 bits of architecture specific CPU ID value
311
- other values: reserved
312
- [0x4] CPU device status fields: (1 byte access)
313
- bits:
314
- 0: Device is enabled and may be used by guest
315
- 1: Device insert event, used to distinguish device for which
316
- no device check event to OSPM was issued.
317
- It's valid only when bit 0 is set.
318
- 2: Device remove event, used to distinguish device for which
319
- no device eject request to OSPM was issued. Firmware must
320
- ignore this bit.
321
- 3: reserved and should be ignored by OSPM
322
- 4: if set to 1, OSPM requests firmware to perform device eject.
323
- 5-7: reserved and should be ignored by OSPM
324
- [0x5-0x7] reserved
325
- [0x8] Command data: (DWORD access)
326
- contains 0 unless value last stored in 'Command field' is one of:
327
- 0: contains 'CPU selector' value of a CPU with pending event[s]
328
- 3: lower 32 bits of architecture specific CPU ID value
329
- (in x86 case: APIC ID)
330
-
331
-write access:
332
- offset:
333
- [0x0-0x3] CPU selector: (DWORD access)
334
- selects active CPU device. All following accesses to other
335
- registers will read/store data from/to selected CPU.
336
- Valid values: [0 .. max_cpus)
337
- [0x4] CPU device control fields: (1 byte access)
338
- bits:
339
- 0: reserved, OSPM must clear it before writing to register.
340
- 1: if set to 1 clears device insert event, set by OSPM
341
- after it has emitted device check event for the
342
- selected CPU device
343
- 2: if set to 1 clears device remove event, set by OSPM
344
- after it has emitted device eject request for the
345
- selected CPU device.
346
- 3: if set to 1 initiates device eject, set by OSPM when it
347
- triggers CPU device removal and calls _EJ0 method or by firmware
348
- when bit #4 is set. In case bit #4 were set, it's cleared as
349
- part of device eject.
350
- 4: if set to 1, OSPM hands over device eject to firmware.
351
- Firmware shall issue device eject request as described above
352
- (bit #3) and OSPM should not touch device eject bit (#3) in case
353
- it's asked firmware to perform CPU device eject.
354
- 5-7: reserved, OSPM must clear them before writing to register
355
- [0x5] Command field: (1 byte access)
356
- value:
357
- 0: selects a CPU device with inserting/removing events and
358
- following reads from 'Command data' register return
359
- selected CPU ('CPU selector' value).
360
- If no CPU with events found, the current 'CPU selector' doesn't
361
- change and corresponding insert/remove event flags are not modified.
362
- 1: following writes to 'Command data' register set OST event
363
- register in QEMU
364
- 2: following writes to 'Command data' register set OST status
365
- register in QEMU
366
- 3: following reads from 'Command data' and 'Command data 2' return
367
- architecture specific CPU ID value for currently selected CPU.
368
- other values: reserved
369
- [0x6-0x7] reserved
370
- [0x8] Command data: (DWORD access)
371
- if last stored 'Command field' value:
372
- 1: stores value into OST event register
373
- 2: stores value into OST status register, triggers
374
- ACPI_DEVICE_OST QMP event from QEMU to external applications
375
- with current values of OST event and status registers.
376
- other values: reserved
377
-
378
-Typical usecases:
379
- - (x86) Detecting and enabling modern CPU hotplug interface.
380
- QEMU starts with legacy CPU hotplug interface enabled. Detecting and
381
- switching to modern interface is based on the 2 legacy CPU hotplug features:
382
- 1. Writes into CPU bitmap are ignored.
383
- 2. CPU bitmap always has bit#0 set, corresponding to boot CPU.
384
-
385
- Use following steps to detect and enable modern CPU hotplug interface:
386
- 1. Store 0x0 to the 'CPU selector' register,
387
- attempting to switch to modern mode
388
- 2. Store 0x0 to the 'CPU selector' register,
389
- to ensure valid selector value
390
- 3. Store 0x0 to the 'Command field' register,
391
- 4. Read the 'Command data 2' register.
392
- If read value is 0x0, the modern interface is enabled.
393
- Otherwise legacy or no CPU hotplug interface available
394
-
395
- - Get a cpu with pending event
396
- 1. Store 0x0 to the 'CPU selector' register.
397
- 2. Store 0x0 to the 'Command field' register.
398
- 3. Read the 'CPU device status fields' register.
399
- 4. If both bit#1 and bit#2 are clear in the value read, there is no CPU
400
- with a pending event and selected CPU remains unchanged.
401
- 5. Otherwise, read the 'Command data' register. The value read is the
402
- selector of the CPU with the pending event (which is already
403
- selected).
404
-
405
- - Enumerate CPUs present/non present CPUs
406
- 01. Set the present CPU count to 0.
407
- 02. Set the iterator to 0.
408
- 03. Store 0x0 to the 'CPU selector' register, to ensure that it's in
409
- a valid state and that access to other registers won't be ignored.
410
- 04. Store 0x0 to the 'Command field' register to make 'Command data'
411
- register return 'CPU selector' value of selected CPU
412
- 05. Read the 'CPU device status fields' register.
413
- 06. If bit#0 is set, increment the present CPU count.
414
- 07. Increment the iterator.
415
- 08. Store the iterator to the 'CPU selector' register.
416
- 09. Read the 'Command data' register.
417
- 10. If the value read is not zero, goto 05.
418
- 11. Otherwise store 0x0 to the 'CPU selector' register, to put it
419
- into a valid state and exit.
420
- The iterator at this point equals "max_cpus".
421
diff --git a/docs/specs/index.rst b/docs/specs/index.rst
15
index XXXXXXX..XXXXXXX 100644
422
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/translate.h
423
--- a/docs/specs/index.rst
17
+++ b/target/arm/translate.h
424
+++ b/docs/specs/index.rst
18
@@ -XXX,XX +XXX,XX @@ typedef void GVecGen3Fn(unsigned, uint32_t, uint32_t,
425
@@ -XXX,XX +XXX,XX @@ guest hardware that is specific to QEMU.
19
typedef void GVecGen4Fn(unsigned, uint32_t, uint32_t, uint32_t,
426
acpi_hw_reduced_hotplug
20
uint32_t, uint32_t, uint32_t);
427
tpm
21
428
acpi_hest_ghes
22
+/* Function prototype for gen_ functions for calling Neon helpers */
429
+ acpi_cpu_hotplug
23
+typedef void NeonGenOneOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32);
24
+typedef void NeonGenTwoOpFn(TCGv_i32, TCGv_i32, TCGv_i32);
25
+typedef void NeonGenTwoOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32, TCGv_i32);
26
+typedef void NeonGenTwo64OpFn(TCGv_i64, TCGv_i64, TCGv_i64);
27
+typedef void NeonGenTwo64OpEnvFn(TCGv_i64, TCGv_ptr, TCGv_i64, TCGv_i64);
28
+typedef void NeonGenNarrowFn(TCGv_i32, TCGv_i64);
29
+typedef void NeonGenNarrowEnvFn(TCGv_i32, TCGv_ptr, TCGv_i64);
30
+typedef void NeonGenWidenFn(TCGv_i64, TCGv_i32);
31
+typedef void NeonGenTwoSingleOPFn(TCGv_i32, TCGv_i32, TCGv_i32, TCGv_ptr);
32
+typedef void NeonGenTwoDoubleOPFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_ptr);
33
+typedef void NeonGenOneOpFn(TCGv_i64, TCGv_i64);
34
+typedef void CryptoTwoOpFn(TCGv_ptr, TCGv_ptr);
35
+typedef void CryptoThreeOpIntFn(TCGv_ptr, TCGv_ptr, TCGv_i32);
36
+typedef void CryptoThreeOpFn(TCGv_ptr, TCGv_ptr, TCGv_ptr);
37
+typedef void AtomicThreeOpFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGArg, MemOp);
38
+
39
#endif /* TARGET_ARM_TRANSLATE_H */
40
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
41
index XXXXXXX..XXXXXXX 100644
42
--- a/target/arm/translate-a64.c
43
+++ b/target/arm/translate-a64.c
44
@@ -XXX,XX +XXX,XX @@ typedef struct AArch64DecodeTable {
45
AArch64DecodeFn *disas_fn;
46
} AArch64DecodeTable;
47
48
-/* Function prototype for gen_ functions for calling Neon helpers */
49
-typedef void NeonGenOneOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32);
50
-typedef void NeonGenTwoOpFn(TCGv_i32, TCGv_i32, TCGv_i32);
51
-typedef void NeonGenTwoOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32, TCGv_i32);
52
-typedef void NeonGenTwo64OpFn(TCGv_i64, TCGv_i64, TCGv_i64);
53
-typedef void NeonGenTwo64OpEnvFn(TCGv_i64, TCGv_ptr, TCGv_i64, TCGv_i64);
54
-typedef void NeonGenNarrowFn(TCGv_i32, TCGv_i64);
55
-typedef void NeonGenNarrowEnvFn(TCGv_i32, TCGv_ptr, TCGv_i64);
56
-typedef void NeonGenWidenFn(TCGv_i64, TCGv_i32);
57
-typedef void NeonGenTwoSingleOPFn(TCGv_i32, TCGv_i32, TCGv_i32, TCGv_ptr);
58
-typedef void NeonGenTwoDoubleOPFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_ptr);
59
-typedef void NeonGenOneOpFn(TCGv_i64, TCGv_i64);
60
-typedef void CryptoTwoOpFn(TCGv_ptr, TCGv_ptr);
61
-typedef void CryptoThreeOpIntFn(TCGv_ptr, TCGv_ptr, TCGv_i32);
62
-typedef void CryptoThreeOpFn(TCGv_ptr, TCGv_ptr, TCGv_ptr);
63
-typedef void AtomicThreeOpFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGArg, MemOp);
64
-
65
/* initialize TCG globals. */
66
void a64_translate_init(void)
67
{
68
--
430
--
69
2.20.1
431
2.20.1
70
432
71
433
diff view generated by jsdifflib
1
Convert the Neon VMUL, VMLA, VMLS and VSHL insns in the
1
Convert the acpi memory hotplug spec to rST.
2
3-reg-same grouping to decodetree.
2
3
Note that this includes converting a lot of weird whitespace
4
characters to plain old spaces (the rST parser does not like
5
whatever the old ones were).
3
6
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
6
Message-id: 20200430181003.21682-20-peter.maydell@linaro.org
9
Message-id: 20210727170414.3368-3-peter.maydell@linaro.org
7
---
10
---
8
target/arm/neon-dp.decode | 9 +++++++
11
docs/specs/acpi_mem_hotplug.rst | 128 ++++++++++++++++++++++++++++++++
9
target/arm/translate-neon.inc.c | 44 +++++++++++++++++++++++++++++++++
12
docs/specs/acpi_mem_hotplug.txt | 94 -----------------------
10
target/arm/translate.c | 28 +++------------------
13
docs/specs/index.rst | 1 +
11
3 files changed, 56 insertions(+), 25 deletions(-)
14
3 files changed, 129 insertions(+), 94 deletions(-)
12
15
create mode 100644 docs/specs/acpi_mem_hotplug.rst
13
diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode
16
delete mode 100644 docs/specs/acpi_mem_hotplug.txt
17
18
diff --git a/docs/specs/acpi_mem_hotplug.rst b/docs/specs/acpi_mem_hotplug.rst
19
new file mode 100644
20
index XXXXXXX..XXXXXXX
21
--- /dev/null
22
+++ b/docs/specs/acpi_mem_hotplug.rst
23
@@ -XXX,XX +XXX,XX @@
24
+QEMU<->ACPI BIOS memory hotplug interface
25
+=========================================
26
+
27
+ACPI BIOS GPE.3 handler is dedicated for notifying OS about memory hot-add
28
+and hot-remove events.
29
+
30
+Memory hot-plug interface (IO port 0xa00-0xa17, 1-4 byte access)
31
+----------------------------------------------------------------
32
+
33
+Read access behavior
34
+^^^^^^^^^^^^^^^^^^^^
35
+
36
+[0x0-0x3]
37
+ Lo part of memory device phys address
38
+[0x4-0x7]
39
+ Hi part of memory device phys address
40
+[0x8-0xb]
41
+ Lo part of memory device size in bytes
42
+[0xc-0xf]
43
+ Hi part of memory device size in bytes
44
+[0x10-0x13]
45
+ Memory device proximity domain
46
+[0x14]
47
+ Memory device status fields
48
+
49
+ bits:
50
+
51
+ 0:
52
+ Device is enabled and may be used by guest
53
+ 1:
54
+ Device insert event, used to distinguish device for which
55
+ no device check event to OSPM was issued.
56
+ It's valid only when bit 1 is set.
57
+ 2:
58
+ Device remove event, used to distinguish device for which
59
+ no device eject request to OSPM was issued.
60
+ 3-7:
61
+ reserved and should be ignored by OSPM
62
+
63
+[0x15-0x17]
64
+ reserved
65
+
66
+Write access behavior
67
+^^^^^^^^^^^^^^^^^^^^^
68
+
69
+
70
+[0x0-0x3]
71
+ Memory device slot selector, selects active memory device.
72
+ All following accesses to other registers in 0xa00-0xa17
73
+ region will read/store data from/to selected memory device.
74
+[0x4-0x7]
75
+ OST event code reported by OSPM
76
+[0x8-0xb]
77
+ OST status code reported by OSPM
78
+[0xc-0x13]
79
+ reserved, writes into it are ignored
80
+[0x14]
81
+ Memory device control fields
82
+
83
+ bits:
84
+
85
+ 0:
86
+ reserved, OSPM must clear it before writing to register.
87
+ Due to BUG in versions prior 2.4 that field isn't cleared
88
+ when other fields are written. Keep it reserved and don't
89
+ try to reuse it.
90
+ 1:
91
+ if set to 1 clears device insert event, set by OSPM
92
+ after it has emitted device check event for the
93
+ selected memory device
94
+ 2:
95
+ if set to 1 clears device remove event, set by OSPM
96
+ after it has emitted device eject request for the
97
+ selected memory device
98
+ 3:
99
+ if set to 1 initiates device eject, set by OSPM when it
100
+ triggers memory device removal and calls _EJ0 method
101
+ 4-7:
102
+ reserved, OSPM must clear them before writing to register
103
+
104
+Selecting memory device slot beyond present range has no effect on platform:
105
+
106
+- write accesses to memory hot-plug registers not documented above are ignored
107
+- read accesses to memory hot-plug registers not documented above return
108
+ all bits set to 1.
109
+
110
+Memory hot remove process diagram
111
+---------------------------------
112
+
113
+::
114
+
115
+ +-------------+ +-----------------------+ +------------------+
116
+ | 1. QEMU | | 2. QEMU | |3. QEMU |
117
+ | device_del +---->+ device unplug request +----->+Send SCI to guest,|
118
+ | | | cb | |return control to |
119
+ | | | | |management |
120
+ +-------------+ +-----------------------+ +------------------+
121
+
122
+ +---------------------------------------------------------------------+
123
+
124
+ +---------------------+ +-------------------------+
125
+ | OSPM: | remove event | OSPM: |
126
+ | send Eject Request, | | Scan memory devices |
127
+ | clear remove event +<-------------+ for event flags |
128
+ | | | |
129
+ +---------------------+ +-------------------------+
130
+ |
131
+ |
132
+ +---------v--------+ +-----------------------+
133
+ | Guest OS: | success | OSPM: |
134
+ | process Ejection +----------->+ Execute _EJ0 method, |
135
+ | request | | set eject bit in flags|
136
+ +------------------+ +-----------------------+
137
+ |failure |
138
+ v v
139
+ +------------------------+ +-----------------------+
140
+ | OSPM: | | QEMU: |
141
+ | set OST event & status | | call device unplug cb |
142
+ | fields | | |
143
+ +------------------------+ +-----------------------+
144
+ | |
145
+ v v
146
+ +------------------+ +-------------------+
147
+ |QEMU: | |QEMU: |
148
+ |Send OST QMP event| |Send device deleted|
149
+ | | |QMP event |
150
+ +------------------+ | |
151
+ +-------------------+
152
diff --git a/docs/specs/acpi_mem_hotplug.txt b/docs/specs/acpi_mem_hotplug.txt
153
deleted file mode 100644
154
index XXXXXXX..XXXXXXX
155
--- a/docs/specs/acpi_mem_hotplug.txt
156
+++ /dev/null
157
@@ -XXX,XX +XXX,XX @@
158
-QEMU<->ACPI BIOS memory hotplug interface
159
---------------------------------------
160
-
161
-ACPI BIOS GPE.3 handler is dedicated for notifying OS about memory hot-add
162
-and hot-remove events.
163
-
164
-Memory hot-plug interface (IO port 0xa00-0xa17, 1-4 byte access):
165
----------------------------------------------------------------
166
-0xa00:
167
- read access:
168
- [0x0-0x3] Lo part of memory device phys address
169
- [0x4-0x7] Hi part of memory device phys address
170
- [0x8-0xb] Lo part of memory device size in bytes
171
- [0xc-0xf] Hi part of memory device size in bytes
172
- [0x10-0x13] Memory device proximity domain
173
- [0x14] Memory device status fields
174
- bits:
175
- 0: Device is enabled and may be used by guest
176
- 1: Device insert event, used to distinguish device for which
177
- no device check event to OSPM was issued.
178
- It's valid only when bit 1 is set.
179
- 2: Device remove event, used to distinguish device for which
180
- no device eject request to OSPM was issued.
181
- 3-7: reserved and should be ignored by OSPM
182
- [0x15-0x17] reserved
183
-
184
- write access:
185
- [0x0-0x3] Memory device slot selector, selects active memory device.
186
- All following accesses to other registers in 0xa00-0xa17
187
- region will read/store data from/to selected memory device.
188
- [0x4-0x7] OST event code reported by OSPM
189
- [0x8-0xb] OST status code reported by OSPM
190
- [0xc-0x13] reserved, writes into it are ignored
191
- [0x14] Memory device control fields
192
- bits:
193
- 0: reserved, OSPM must clear it before writing to register.
194
- Due to BUG in versions prior 2.4 that field isn't cleared
195
- when other fields are written. Keep it reserved and don't
196
- try to reuse it.
197
- 1: if set to 1 clears device insert event, set by OSPM
198
- after it has emitted device check event for the
199
- selected memory device
200
- 2: if set to 1 clears device remove event, set by OSPM
201
- after it has emitted device eject request for the
202
- selected memory device
203
- 3: if set to 1 initiates device eject, set by OSPM when it
204
- triggers memory device removal and calls _EJ0 method
205
- 4-7: reserved, OSPM must clear them before writing to register
206
-
207
-Selecting memory device slot beyond present range has no effect on platform:
208
- - write accesses to memory hot-plug registers not documented above are
209
- ignored
210
- - read accesses to memory hot-plug registers not documented above return
211
- all bits set to 1.
212
-
213
-Memory hot remove process diagram:
214
-----------------------------------
215
- +-------------+     +-----------------------+      +------------------+     
216
- |  1. QEMU    |     | 2. QEMU               |      |3. QEMU           |     
217
- |  device_del +---->+ device unplug request +----->+Send SCI to guest,|     
218
- |             |     |         cb            |      |return control to |     
219
- +-------------+     +-----------------------+      |management        |     
220
-                                                    +------------------+     
221
-                                                                             
222
- +---------------------------------------------------------------------+     
223
-                                                                             
224
- +---------------------+              +-------------------------+            
225
- | OSPM:               | remove event | OSPM:                   |            
226
- | send Eject Request, |              | Scan memory devices     |            
227
- | clear remove event  +<-------------+ for event flags         |            
228
- |                     |              |                         |            
229
- +---------------------+              +-------------------------+            
230
-           |                                                                 
231
-           |                                                                 
232
- +---------v--------+            +-----------------------+                   
233
- | Guest OS:        |  success   | OSPM:                 |                   
234
- | process Ejection +----------->+ Execute _EJ0 method,  |                   
235
- | request          |            | set eject bit in flags|                   
236
- +------------------+            +-----------------------+                   
237
-           |failure                         |                                
238
-           v                                v                                
239
- +------------------------+      +-----------------------+                   
240
- | OSPM:                  |      | QEMU:                 |                   
241
- | set OST event & status |      | call device unplug cb |                   
242
- | fields                 |      |                       |                   
243
- +------------------------+      +-----------------------+                   
244
-          |                                  |                               
245
-          v                                  v                               
246
- +------------------+              +-------------------+                     
247
- |QEMU:             |              |QEMU:              |                     
248
- |Send OST QMP event|              |Send device deleted|                     
249
- |                  |              |QMP event          |                     
250
- +------------------+              |                   |                     
251
-                                   +-------------------+
252
diff --git a/docs/specs/index.rst b/docs/specs/index.rst
14
index XXXXXXX..XXXXXXX 100644
253
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/neon-dp.decode
254
--- a/docs/specs/index.rst
16
+++ b/target/arm/neon-dp.decode
255
+++ b/docs/specs/index.rst
17
@@ -XXX,XX +XXX,XX @@ VCGT_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 0 .... @3same
256
@@ -XXX,XX +XXX,XX @@ guest hardware that is specific to QEMU.
18
VCGE_S_3s 1111 001 0 0 . .. .... .... 0011 . . . 1 .... @3same
257
tpm
19
VCGE_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 1 .... @3same
258
acpi_hest_ghes
20
259
acpi_cpu_hotplug
21
+VSHL_S_3s 1111 001 0 0 . .. .... .... 0100 . . . 0 .... @3same
260
+ acpi_mem_hotplug
22
+VSHL_U_3s 1111 001 1 0 . .. .... .... 0100 . . . 0 .... @3same
23
+
24
VMAX_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 0 .... @3same
25
VMAX_U_3s 1111 001 1 0 . .. .... .... 0110 . . . 0 .... @3same
26
VMIN_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 1 .... @3same
27
@@ -XXX,XX +XXX,XX @@ VSUB_3s 1111 001 1 0 . .. .... .... 1000 . . . 0 .... @3same
28
29
VTST_3s 1111 001 0 0 . .. .... .... 1000 . . . 1 .... @3same
30
VCEQ_3s 1111 001 1 0 . .. .... .... 1000 . . . 1 .... @3same
31
+
32
+VMLA_3s 1111 001 0 0 . .. .... .... 1001 . . . 0 .... @3same
33
+VMLS_3s 1111 001 1 0 . .. .... .... 1001 . . . 0 .... @3same
34
+
35
+VMUL_3s 1111 001 0 0 . .. .... .... 1001 . . . 1 .... @3same
36
+VMUL_p_3s 1111 001 1 0 . .. .... .... 1001 . . . 1 .... @3same
37
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
38
index XXXXXXX..XXXXXXX 100644
39
--- a/target/arm/translate-neon.inc.c
40
+++ b/target/arm/translate-neon.inc.c
41
@@ -XXX,XX +XXX,XX @@ DO_3SAME_NO_SZ_3(VMAX_S, tcg_gen_gvec_smax)
42
DO_3SAME_NO_SZ_3(VMAX_U, tcg_gen_gvec_umax)
43
DO_3SAME_NO_SZ_3(VMIN_S, tcg_gen_gvec_smin)
44
DO_3SAME_NO_SZ_3(VMIN_U, tcg_gen_gvec_umin)
45
+DO_3SAME_NO_SZ_3(VMUL, tcg_gen_gvec_mul)
46
47
#define DO_3SAME_CMP(INSN, COND) \
48
static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \
49
@@ -XXX,XX +XXX,XX @@ DO_3SAME_GVEC4(VQADD_S, sqadd_op)
50
DO_3SAME_GVEC4(VQADD_U, uqadd_op)
51
DO_3SAME_GVEC4(VQSUB_S, sqsub_op)
52
DO_3SAME_GVEC4(VQSUB_U, uqsub_op)
53
+
54
+static void gen_VMUL_p_3s(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs,
55
+ uint32_t rm_ofs, uint32_t oprsz, uint32_t maxsz)
56
+{
57
+ tcg_gen_gvec_3_ool(rd_ofs, rn_ofs, rm_ofs, oprsz, maxsz,
58
+ 0, gen_helper_gvec_pmul_b);
59
+}
60
+
61
+static bool trans_VMUL_p_3s(DisasContext *s, arg_3same *a)
62
+{
63
+ if (a->size != 0) {
64
+ return false;
65
+ }
66
+ return do_3same(s, a, gen_VMUL_p_3s);
67
+}
68
+
69
+#define DO_3SAME_GVEC3_NO_SZ_3(INSN, OPARRAY) \
70
+ static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \
71
+ uint32_t rn_ofs, uint32_t rm_ofs, \
72
+ uint32_t oprsz, uint32_t maxsz) \
73
+ { \
74
+ tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs, \
75
+ oprsz, maxsz, &OPARRAY[vece]); \
76
+ } \
77
+ DO_3SAME_NO_SZ_3(INSN, gen_##INSN##_3s)
78
+
79
+
80
+DO_3SAME_GVEC3_NO_SZ_3(VMLA, mla_op)
81
+DO_3SAME_GVEC3_NO_SZ_3(VMLS, mls_op)
82
+
83
+#define DO_3SAME_GVEC3_SHIFT(INSN, OPARRAY) \
84
+ static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \
85
+ uint32_t rn_ofs, uint32_t rm_ofs, \
86
+ uint32_t oprsz, uint32_t maxsz) \
87
+ { \
88
+ /* Note the operation is vshl vd,vm,vn */ \
89
+ tcg_gen_gvec_3(rd_ofs, rm_ofs, rn_ofs, \
90
+ oprsz, maxsz, &OPARRAY[vece]); \
91
+ } \
92
+ DO_3SAME(INSN, gen_##INSN##_3s)
93
+
94
+DO_3SAME_GVEC3_SHIFT(VSHL_S, sshl_op)
95
+DO_3SAME_GVEC3_SHIFT(VSHL_U, ushl_op)
96
diff --git a/target/arm/translate.c b/target/arm/translate.c
97
index XXXXXXX..XXXXXXX 100644
98
--- a/target/arm/translate.c
99
+++ b/target/arm/translate.c
100
@@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
101
}
102
return 1;
103
104
- case NEON_3R_VMUL: /* VMUL */
105
- if (u) {
106
- /* Polynomial case allows only P8. */
107
- if (size != 0) {
108
- return 1;
109
- }
110
- tcg_gen_gvec_3_ool(rd_ofs, rn_ofs, rm_ofs, vec_size, vec_size,
111
- 0, gen_helper_gvec_pmul_b);
112
- } else {
113
- tcg_gen_gvec_mul(size, rd_ofs, rn_ofs, rm_ofs,
114
- vec_size, vec_size);
115
- }
116
- return 0;
117
-
118
- case NEON_3R_VML: /* VMLA, VMLS */
119
- tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs, vec_size, vec_size,
120
- u ? &mls_op[size] : &mla_op[size]);
121
- return 0;
122
-
123
- case NEON_3R_VSHL:
124
- /* Note the operation is vshl vd,vm,vn */
125
- tcg_gen_gvec_3(rd_ofs, rm_ofs, rn_ofs, vec_size, vec_size,
126
- u ? &ushl_op[size] : &sshl_op[size]);
127
- return 0;
128
-
129
case NEON_3R_VADD_VSUB:
130
case NEON_3R_LOGIC:
131
case NEON_3R_VMAX:
132
@@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
133
case NEON_3R_VCGE:
134
case NEON_3R_VQADD:
135
case NEON_3R_VQSUB:
136
+ case NEON_3R_VMUL:
137
+ case NEON_3R_VML:
138
+ case NEON_3R_VSHL:
139
/* Already handled by decodetree */
140
return 1;
141
}
142
--
261
--
143
2.20.1
262
2.20.1
144
263
145
264
diff view generated by jsdifflib
1
Convert the Neon VQADD/VQSUB insns in the 3-reg-same grouping
1
Convert the PCI hotplug spec document to rST.
2
to decodetree.
3
2
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
4
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
6
Message-id: 20200430181003.21682-19-peter.maydell@linaro.org
7
---
5
---
8
target/arm/neon-dp.decode | 6 ++++++
6
...i_pci_hotplug.txt => acpi_pci_hotplug.rst} | 37 ++++++++++---------
9
target/arm/translate-neon.inc.c | 15 +++++++++++++++
7
docs/specs/index.rst | 1 +
10
target/arm/translate.c | 14 ++------------
8
2 files changed, 21 insertions(+), 17 deletions(-)
11
3 files changed, 23 insertions(+), 12 deletions(-)
9
rename docs/specs/{acpi_pci_hotplug.txt => acpi_pci_hotplug.rst} (51%)
12
10
13
diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode
11
diff --git a/docs/specs/acpi_pci_hotplug.txt b/docs/specs/acpi_pci_hotplug.rst
12
similarity index 51%
13
rename from docs/specs/acpi_pci_hotplug.txt
14
rename to docs/specs/acpi_pci_hotplug.rst
14
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/neon-dp.decode
16
--- a/docs/specs/acpi_pci_hotplug.txt
16
+++ b/target/arm/neon-dp.decode
17
+++ b/docs/specs/acpi_pci_hotplug.rst
17
@@ -XXX,XX +XXX,XX @@
18
@@ -XXX,XX +XXX,XX @@
18
@3same .... ... . . . size:2 .... .... .... . q:1 . . .... \
19
QEMU<->ACPI BIOS PCI hotplug interface
19
&3same vm=%vm_dp vn=%vn_dp vd=%vd_dp
20
---------------------------------------
20
21
+======================================
21
+VQADD_S_3s 1111 001 0 0 . .. .... .... 0000 . . . 1 .... @3same
22
22
+VQADD_U_3s 1111 001 1 0 . .. .... .... 0000 . . . 1 .... @3same
23
QEMU supports PCI hotplug via ACPI, for PCI bus 0. This document
24
describes the interface between QEMU and the ACPI BIOS.
25
26
-ACPI GPE block (IO ports 0xafe0-0xafe3, byte access):
27
------------------------------------------
28
+ACPI GPE block (IO ports 0xafe0-0xafe3, byte access)
29
+----------------------------------------------------
30
31
Generic ACPI GPE block. Bit 1 (GPE.1) used to notify PCI hotplug/eject
32
event to ACPI BIOS, via SCI interrupt.
33
34
-PCI slot injection notification pending (IO port 0xae00-0xae03, 4-byte access):
35
----------------------------------------------------------------
36
+PCI slot injection notification pending (IO port 0xae00-0xae03, 4-byte access)
37
+------------------------------------------------------------------------------
23
+
38
+
24
@3same_logic .... ... . . . .. .... .... .... . q:1 .. .... \
39
Slot injection notification pending. One bit per slot.
25
&3same vm=%vm_dp vn=%vn_dp vd=%vd_dp size=0
40
26
41
Read by ACPI BIOS GPE.1 handler to notify OS of injection
27
@@ -XXX,XX +XXX,XX @@ VBSL_3s 1111 001 1 0 . 01 .... .... 0001 ... 1 .... @3same_logic
42
events. Read-only.
28
VBIT_3s 1111 001 1 0 . 10 .... .... 0001 ... 1 .... @3same_logic
43
29
VBIF_3s 1111 001 1 0 . 11 .... .... 0001 ... 1 .... @3same_logic
44
-PCI slot removal notification (IO port 0xae04-0xae07, 4-byte access):
30
45
------------------------------------------------------
31
+VQSUB_S_3s 1111 001 0 0 . .. .... .... 0010 . . . 1 .... @3same
46
+PCI slot removal notification (IO port 0xae04-0xae07, 4-byte access)
32
+VQSUB_U_3s 1111 001 1 0 . .. .... .... 0010 . . . 1 .... @3same
47
+--------------------------------------------------------------------
33
+
48
+
34
VCGT_S_3s 1111 001 0 0 . .. .... .... 0011 . . . 0 .... @3same
49
Slot removal notification pending. One bit per slot.
35
VCGT_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 0 .... @3same
50
36
VCGE_S_3s 1111 001 0 0 . .. .... .... 0011 . . . 1 .... @3same
51
Read by ACPI BIOS GPE.1 handler to notify OS of removal
37
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
52
events. Read-only.
53
54
-PCI device eject (IO port 0xae08-0xae0b, 4-byte access):
55
-----------------------------------------
56
+PCI device eject (IO port 0xae08-0xae0b, 4-byte access)
57
+-------------------------------------------------------
58
59
Write: Used by ACPI BIOS _EJ0 method to request device removal.
60
One bit per slot.
61
62
Read: Hotplug features register. Used by platform to identify features
63
available. Current base feature set (no bits set):
64
- - Read-only "up" register @0xae00, 4-byte access, bit per slot
65
- - Read-only "down" register @0xae04, 4-byte access, bit per slot
66
- - Read/write "eject" register @0xae08, 4-byte access,
67
- write: bit per slot eject, read: hotplug feature set
68
- - Read-only hotplug capable register @0xae0c, 4-byte access, bit per slot
69
70
-PCI removability status (IO port 0xae0c-0xae0f, 4-byte access):
71
------------------------------------------------
72
+- Read-only "up" register @0xae00, 4-byte access, bit per slot
73
+- Read-only "down" register @0xae04, 4-byte access, bit per slot
74
+- Read/write "eject" register @0xae08, 4-byte access,
75
+ write: bit per slot eject, read: hotplug feature set
76
+- Read-only hotplug capable register @0xae0c, 4-byte access, bit per slot
77
+
78
+PCI removability status (IO port 0xae0c-0xae0f, 4-byte access)
79
+--------------------------------------------------------------
80
81
Used by ACPI BIOS _RMV method to indicate removability status to OS. One
82
-bit per slot. Read-only
83
+bit per slot. Read-only.
84
diff --git a/docs/specs/index.rst b/docs/specs/index.rst
38
index XXXXXXX..XXXXXXX 100644
85
index XXXXXXX..XXXXXXX 100644
39
--- a/target/arm/translate-neon.inc.c
86
--- a/docs/specs/index.rst
40
+++ b/target/arm/translate-neon.inc.c
87
+++ b/docs/specs/index.rst
41
@@ -XXX,XX +XXX,XX @@ static void gen_VTST_3s(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs,
88
@@ -XXX,XX +XXX,XX @@ guest hardware that is specific to QEMU.
42
tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs, oprsz, maxsz, &cmtst_op[vece]);
89
acpi_hest_ghes
43
}
90
acpi_cpu_hotplug
44
DO_3SAME_NO_SZ_3(VTST, gen_VTST_3s)
91
acpi_mem_hotplug
45
+
92
+ acpi_pci_hotplug
46
+#define DO_3SAME_GVEC4(INSN, OPARRAY) \
47
+ static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \
48
+ uint32_t rn_ofs, uint32_t rm_ofs, \
49
+ uint32_t oprsz, uint32_t maxsz) \
50
+ { \
51
+ tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc), \
52
+ rn_ofs, rm_ofs, oprsz, maxsz, &OPARRAY[vece]); \
53
+ } \
54
+ DO_3SAME(INSN, gen_##INSN##_3s)
55
+
56
+DO_3SAME_GVEC4(VQADD_S, sqadd_op)
57
+DO_3SAME_GVEC4(VQADD_U, uqadd_op)
58
+DO_3SAME_GVEC4(VQSUB_S, sqsub_op)
59
+DO_3SAME_GVEC4(VQSUB_U, uqsub_op)
60
diff --git a/target/arm/translate.c b/target/arm/translate.c
61
index XXXXXXX..XXXXXXX 100644
62
--- a/target/arm/translate.c
63
+++ b/target/arm/translate.c
64
@@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
65
}
66
return 1;
67
68
- case NEON_3R_VQADD:
69
- tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc),
70
- rn_ofs, rm_ofs, vec_size, vec_size,
71
- (u ? uqadd_op : sqadd_op) + size);
72
- return 0;
73
-
74
- case NEON_3R_VQSUB:
75
- tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc),
76
- rn_ofs, rm_ofs, vec_size, vec_size,
77
- (u ? uqsub_op : sqsub_op) + size);
78
- return 0;
79
-
80
case NEON_3R_VMUL: /* VMUL */
81
if (u) {
82
/* Polynomial case allows only P8. */
83
@@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
84
case NEON_3R_VTST_VCEQ:
85
case NEON_3R_VCGT:
86
case NEON_3R_VCGE:
87
+ case NEON_3R_VQADD:
88
+ case NEON_3R_VQSUB:
89
/* Already handled by decodetree */
90
return 1;
91
}
92
--
93
--
93
2.20.1
94
2.20.1
94
95
95
96
diff view generated by jsdifflib
1
Convert the Neon comparison ops in the 3-reg-same grouping
1
Convert the ACPI NVDIMM spec document to rST.
2
to decodetree.
3
2
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
4
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
6
Message-id: 20200430181003.21682-18-peter.maydell@linaro.org
5
Message-id: 20210727170414.3368-5-peter.maydell@linaro.org
7
---
6
---
8
target/arm/neon-dp.decode | 8 ++++++++
7
docs/specs/acpi_nvdimm.rst | 228 +++++++++++++++++++++++++++++++++++++
9
target/arm/translate-neon.inc.c | 22 ++++++++++++++++++++++
8
docs/specs/acpi_nvdimm.txt | 188 ------------------------------
10
target/arm/translate.c | 23 +++--------------------
9
docs/specs/index.rst | 1 +
11
3 files changed, 33 insertions(+), 20 deletions(-)
10
3 files changed, 229 insertions(+), 188 deletions(-)
11
create mode 100644 docs/specs/acpi_nvdimm.rst
12
delete mode 100644 docs/specs/acpi_nvdimm.txt
12
13
13
diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode
14
diff --git a/docs/specs/acpi_nvdimm.rst b/docs/specs/acpi_nvdimm.rst
15
new file mode 100644
16
index XXXXXXX..XXXXXXX
17
--- /dev/null
18
+++ b/docs/specs/acpi_nvdimm.rst
19
@@ -XXX,XX +XXX,XX @@
20
+QEMU<->ACPI BIOS NVDIMM interface
21
+=================================
22
+
23
+QEMU supports NVDIMM via ACPI. This document describes the basic concepts of
24
+NVDIMM ACPI and the interface between QEMU and the ACPI BIOS.
25
+
26
+NVDIMM ACPI Background
27
+----------------------
28
+
29
+NVDIMM is introduced in ACPI 6.0 which defines an NVDIMM root device under
30
+_SB scope with a _HID of "ACPI0012". For each NVDIMM present or intended
31
+to be supported by platform, platform firmware also exposes an ACPI
32
+Namespace Device under the root device.
33
+
34
+The NVDIMM child devices under the NVDIMM root device are defined with _ADR
35
+corresponding to the NFIT device handle. The NVDIMM root device and the
36
+NVDIMM devices can have device specific methods (_DSM) to provide additional
37
+functions specific to a particular NVDIMM implementation.
38
+
39
+This is an example from ACPI 6.0, a platform contains one NVDIMM::
40
+
41
+ Scope (\_SB){
42
+ Device (NVDR) // Root device
43
+ {
44
+ Name (_HID, "ACPI0012")
45
+ Method (_STA) {...}
46
+ Method (_FIT) {...}
47
+ Method (_DSM, ...) {...}
48
+ Device (NVD)
49
+ {
50
+ Name(_ADR, h) //where h is NFIT Device Handle for this NVDIMM
51
+ Method (_DSM, ...) {...}
52
+ }
53
+ }
54
+ }
55
+
56
+Methods supported on both NVDIMM root device and NVDIMM device
57
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
58
+
59
+_DSM (Device Specific Method)
60
+ It is a control method that enables devices to provide device specific
61
+ control functions that are consumed by the device driver.
62
+ The NVDIMM DSM specification can be found at
63
+ http://pmem.io/documents/NVDIMM_DSM_Interface_Example.pdf
64
+
65
+ Arguments:
66
+
67
+ Arg0
68
+ A Buffer containing a UUID (16 Bytes)
69
+ Arg1
70
+ An Integer containing the Revision ID (4 Bytes)
71
+ Arg2
72
+ An Integer containing the Function Index (4 Bytes)
73
+ Arg3
74
+ A package containing parameters for the function specified by the
75
+ UUID, Revision ID, and Function Index
76
+
77
+ Return Value:
78
+
79
+ If Function Index = 0, a Buffer containing a function index bitfield.
80
+ Otherwise, the return value and type depends on the UUID, revision ID
81
+ and function index which are described in the DSM specification.
82
+
83
+Methods on NVDIMM ROOT Device
84
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
85
+
86
+_FIT(Firmware Interface Table)
87
+ It evaluates to a buffer returning data in the format of a series of NFIT
88
+ Type Structure.
89
+
90
+ Arguments: None
91
+
92
+ Return Value:
93
+ A Buffer containing a list of NFIT Type structure entries.
94
+
95
+ The detailed definition of the structure can be found at ACPI 6.0: 5.2.25
96
+ NVDIMM Firmware Interface Table (NFIT).
97
+
98
+QEMU NVDIMM Implementation
99
+--------------------------
100
+
101
+QEMU uses 4 bytes IO Port starting from 0x0a18 and a RAM-based memory page
102
+for NVDIMM ACPI.
103
+
104
+Memory:
105
+ QEMU uses BIOS Linker/loader feature to ask BIOS to allocate a memory
106
+ page and dynamically patch its address into an int32 object named "MEMA"
107
+ in ACPI.
108
+
109
+ This page is RAM-based and it is used to transfer data between _DSM
110
+ method and QEMU. If ACPI has control, this pages is owned by ACPI which
111
+ writes _DSM input data to it, otherwise, it is owned by QEMU which
112
+ emulates _DSM access and writes the output data to it.
113
+
114
+ ACPI writes _DSM Input Data (based on the offset in the page):
115
+
116
+ [0x0 - 0x3]
117
+ 4 bytes, NVDIMM Device Handle.
118
+
119
+ The handle is completely QEMU internal thing, the values in
120
+ range [1, 0xFFFF] indicate nvdimm device. Other values are
121
+ reserved for other purposes.
122
+
123
+ Reserved handles:
124
+
125
+ - 0 is reserved for nvdimm root device named NVDR.
126
+ - 0x10000 is reserved for QEMU internal DSM function called on
127
+ the root device.
128
+
129
+ [0x4 - 0x7]
130
+ 4 bytes, Revision ID, that is the Arg1 of _DSM method.
131
+
132
+ [0x8 - 0xB]
133
+ 4 bytes. Function Index, that is the Arg2 of _DSM method.
134
+
135
+ [0xC - 0xFFF]
136
+ 4084 bytes, the Arg3 of _DSM method.
137
+
138
+ QEMU writes Output Data (based on the offset in the page):
139
+
140
+ [0x0 - 0x3]
141
+ 4 bytes, the length of result
142
+
143
+ [0x4 - 0xFFF]
144
+ 4092 bytes, the DSM result filled by QEMU
145
+
146
+IO Port 0x0a18 - 0xa1b:
147
+ ACPI writes the address of the memory page allocated by BIOS to this
148
+ port then QEMU gets the control and fills the result in the memory page.
149
+
150
+ Write Access:
151
+
152
+ [0x0a18 - 0xa1b]
153
+ 4 bytes, the address of the memory page allocated by BIOS.
154
+
155
+_DSM process diagram
156
+--------------------
157
+
158
+"MEMA" indicates the address of memory page allocated by BIOS.
159
+
160
+::
161
+
162
+ +----------------------+ +-----------------------+
163
+ | 1. OSPM | | 2. OSPM |
164
+ | save _DSM input data | | write "MEMA" to | Exit to QEMU
165
+ | to the page +----->| IO port 0x0a18 +------------+
166
+ | indicated by "MEMA" | | | |
167
+ +----------------------+ +-----------------------+ |
168
+ |
169
+ v
170
+ +--------------------+ +-----------+ +------------------+--------+
171
+ | 5 QEMU | | 4 QEMU | | 3. QEMU |
172
+ | write _DSM result | | emulate | | get _DSM input data from |
173
+ | to the page +<------+ _DSM +<-----+ the page indicated by the |
174
+ | | | | | value from the IO port |
175
+ +--------+-----------+ +-----------+ +---------------------------+
176
+ |
177
+ | Enter Guest
178
+ |
179
+ v
180
+ +--------------------------+ +--------------+
181
+ | 6 OSPM | | 7 OSPM |
182
+ | result size is returned | | _DSM return |
183
+ | by reading DSM +----->+ |
184
+ | result from the page | | |
185
+ +--------------------------+ +--------------+
186
+
187
+NVDIMM hotplug
188
+--------------
189
+
190
+ACPI BIOS GPE.4 handler is dedicated for notifying OS about nvdimm device
191
+hot-add event.
192
+
193
+QEMU internal use only _DSM functions
194
+-------------------------------------
195
+
196
+Read FIT
197
+^^^^^^^^
198
+
199
+_FIT method uses _DSM method to fetch NFIT structures blob from QEMU
200
+in 1 page sized increments which are then concatenated and returned
201
+as _FIT method result.
202
+
203
+Input parameters:
204
+
205
+Arg0
206
+ UUID {set to 648B9CF2-CDA1-4312-8AD9-49C4AF32BD62}
207
+Arg1
208
+ Revision ID (set to 1)
209
+Arg2
210
+ Function Index, 0x1
211
+Arg3
212
+ A package containing a buffer whose layout is as follows:
213
+
214
+ +----------+--------+--------+-------------------------------------------+
215
+ | Field | Length | Offset | Description |
216
+ +----------+--------+--------+-------------------------------------------+
217
+ | offset | 4 | 0 | offset in QEMU's NFIT structures blob to |
218
+ | | | | read from |
219
+ +----------+--------+--------+-------------------------------------------+
220
+
221
+Output layout in the dsm memory page:
222
+
223
+ +----------+--------+--------+-------------------------------------------+
224
+ | Field | Length | Offset | Description |
225
+ +----------+--------+--------+-------------------------------------------+
226
+ | length | 4 | 0 | length of entire returned data |
227
+ | | | | (including this header) |
228
+ +----------+--------+--------+-------------------------------------------+
229
+ | | | | return status codes |
230
+ | | | | |
231
+ | | | | - 0x0 - success |
232
+ | | | | - 0x100 - error caused by NFIT update |
233
+ | status | 4 | 4 | while read by _FIT wasn't completed |
234
+ | | | | - other codes follow Chapter 3 in |
235
+ | | | | DSM Spec Rev1 |
236
+ +----------+--------+--------+-------------------------------------------+
237
+ | fit data | Varies | 8 | contains FIT data. This field is present |
238
+ | | | | if status field is 0. |
239
+ +----------+--------+--------+-------------------------------------------+
240
+
241
+The FIT offset is maintained by the OSPM itself, current offset plus
242
+the size of the fit data returned by the function is the next offset
243
+OSPM should read. When all FIT data has been read out, zero fit data
244
+size is returned.
245
+
246
+If it returns status code 0x100, OSPM should restart to read FIT (read
247
+from offset 0 again).
248
diff --git a/docs/specs/acpi_nvdimm.txt b/docs/specs/acpi_nvdimm.txt
249
deleted file mode 100644
250
index XXXXXXX..XXXXXXX
251
--- a/docs/specs/acpi_nvdimm.txt
252
+++ /dev/null
253
@@ -XXX,XX +XXX,XX @@
254
-QEMU<->ACPI BIOS NVDIMM interface
255
----------------------------------
256
-
257
-QEMU supports NVDIMM via ACPI. This document describes the basic concepts of
258
-NVDIMM ACPI and the interface between QEMU and the ACPI BIOS.
259
-
260
-NVDIMM ACPI Background
261
-----------------------
262
-NVDIMM is introduced in ACPI 6.0 which defines an NVDIMM root device under
263
-_SB scope with a _HID of “ACPI0012”. For each NVDIMM present or intended
264
-to be supported by platform, platform firmware also exposes an ACPI
265
-Namespace Device under the root device.
266
-
267
-The NVDIMM child devices under the NVDIMM root device are defined with _ADR
268
-corresponding to the NFIT device handle. The NVDIMM root device and the
269
-NVDIMM devices can have device specific methods (_DSM) to provide additional
270
-functions specific to a particular NVDIMM implementation.
271
-
272
-This is an example from ACPI 6.0, a platform contains one NVDIMM:
273
-
274
-Scope (\_SB){
275
- Device (NVDR) // Root device
276
- {
277
- Name (_HID, “ACPI0012”)
278
- Method (_STA) {...}
279
- Method (_FIT) {...}
280
- Method (_DSM, ...) {...}
281
- Device (NVD)
282
- {
283
- Name(_ADR, h) //where h is NFIT Device Handle for this NVDIMM
284
- Method (_DSM, ...) {...}
285
- }
286
- }
287
-}
288
-
289
-Method supported on both NVDIMM root device and NVDIMM device
290
-_DSM (Device Specific Method)
291
- It is a control method that enables devices to provide device specific
292
- control functions that are consumed by the device driver.
293
- The NVDIMM DSM specification can be found at:
294
- http://pmem.io/documents/NVDIMM_DSM_Interface_Example.pdf
295
-
296
- Arguments:
297
- Arg0 – A Buffer containing a UUID (16 Bytes)
298
- Arg1 – An Integer containing the Revision ID (4 Bytes)
299
- Arg2 – An Integer containing the Function Index (4 Bytes)
300
- Arg3 – A package containing parameters for the function specified by the
301
- UUID, Revision ID, and Function Index
302
-
303
- Return Value:
304
- If Function Index = 0, a Buffer containing a function index bitfield.
305
- Otherwise, the return value and type depends on the UUID, revision ID
306
- and function index which are described in the DSM specification.
307
-
308
-Methods on NVDIMM ROOT Device
309
-_FIT(Firmware Interface Table)
310
- It evaluates to a buffer returning data in the format of a series of NFIT
311
- Type Structure.
312
-
313
- Arguments: None
314
-
315
- Return Value:
316
- A Buffer containing a list of NFIT Type structure entries.
317
-
318
- The detailed definition of the structure can be found at ACPI 6.0: 5.2.25
319
- NVDIMM Firmware Interface Table (NFIT).
320
-
321
-QEMU NVDIMM Implementation
322
-==========================
323
-QEMU uses 4 bytes IO Port starting from 0x0a18 and a RAM-based memory page
324
-for NVDIMM ACPI.
325
-
326
-Memory:
327
- QEMU uses BIOS Linker/loader feature to ask BIOS to allocate a memory
328
- page and dynamically patch its address into an int32 object named "MEMA"
329
- in ACPI.
330
-
331
- This page is RAM-based and it is used to transfer data between _DSM
332
- method and QEMU. If ACPI has control, this pages is owned by ACPI which
333
- writes _DSM input data to it, otherwise, it is owned by QEMU which
334
- emulates _DSM access and writes the output data to it.
335
-
336
- ACPI writes _DSM Input Data (based on the offset in the page):
337
- [0x0 - 0x3]: 4 bytes, NVDIMM Device Handle.
338
-
339
- The handle is completely QEMU internal thing, the values in
340
- range [1, 0xFFFF] indicate nvdimm device. Other values are
341
- reserved for other purposes.
342
-
343
- Reserved handles:
344
- 0 is reserved for nvdimm root device named NVDR.
345
- 0x10000 is reserved for QEMU internal DSM function called on
346
- the root device.
347
-
348
- [0x4 - 0x7]: 4 bytes, Revision ID, that is the Arg1 of _DSM method.
349
- [0x8 - 0xB]: 4 bytes. Function Index, that is the Arg2 of _DSM method.
350
- [0xC - 0xFFF]: 4084 bytes, the Arg3 of _DSM method.
351
-
352
- QEMU Writes Output Data (based on the offset in the page):
353
- [0x0 - 0x3]: 4 bytes, the length of result
354
- [0x4 - 0xFFF]: 4092 bytes, the DSM result filled by QEMU
355
-
356
-IO Port 0x0a18 - 0xa1b:
357
- ACPI writes the address of the memory page allocated by BIOS to this
358
- port then QEMU gets the control and fills the result in the memory page.
359
-
360
- write Access:
361
- [0x0a18 - 0xa1b]: 4 bytes, the address of the memory page allocated
362
- by BIOS.
363
-
364
-_DSM process diagram:
365
----------------------
366
-"MEMA" indicates the address of memory page allocated by BIOS.
367
-
368
- +----------------------+   +-----------------------+
369
- |   1. OSPM   |      | 2. OSPM |
370
- | save _DSM input data | | write "MEMA" to | Exit to QEMU
371
- | to the page +----->| IO port 0x0a18 +------------+
372
- | indicated by "MEMA" | | | |
373
- +----------------------+ +-----------------------+ |
374
-  |
375
-  v
376
- +------------- ----+ +-----------+ +------------------+--------+
377
- | 5 QEMU | | 4 QEMU | | 3. QEMU |
378
- | write _DSM result | | emulate | | get _DSM input data from |
379
- | to the page +<------+ _DSM +<-----+ the page indicated by the |
380
- | | | | | value from the IO port |
381
- +--------+-----------+ +-----------+ +---------------------------+
382
- |
383
- | Enter Guest
384
- |
385
- v
386
- +--------------------------+ +--------------+
387
- | 6 OSPM | | 7 OSPM |
388
- | result size is returned | | _DSM return |
389
- | by reading DSM +----->+ |
390
- | result from the page | | |
391
- +--------------------------+ +--------------+
392
-
393
-NVDIMM hotplug
394
---------------
395
-ACPI BIOS GPE.4 handler is dedicated for notifying OS about nvdimm device
396
-hot-add event.
397
-
398
-QEMU internal use only _DSM function
399
-------------------------------------
400
-1) Read FIT
401
- _FIT method uses _DSM method to fetch NFIT structures blob from QEMU
402
- in 1 page sized increments which are then concatenated and returned
403
- as _FIT method result.
404
-
405
- Input parameters:
406
- Arg0 – UUID {set to 648B9CF2-CDA1-4312-8AD9-49C4AF32BD62}
407
- Arg1 – Revision ID (set to 1)
408
- Arg2 - Function Index, 0x1
409
- Arg3 - A package containing a buffer whose layout is as follows:
410
-
411
- +----------+--------+--------+-------------------------------------------+
412
- | Field | Length | Offset | Description |
413
- +----------+--------+--------+-------------------------------------------+
414
- | offset | 4 | 0 | offset in QEMU's NFIT structures blob to |
415
- | | | | read from |
416
- +----------+--------+--------+-------------------------------------------+
417
-
418
- Output layout in the dsm memory page:
419
- +----------+--------+--------+-------------------------------------------+
420
- | Field | Length | Offset | Description |
421
- +----------+--------+--------+-------------------------------------------+
422
- | length | 4 | 0 | length of entire returned data |
423
- | | | | (including this header) |
424
- +----------+-----------------+-------------------------------------------+
425
- | | | | return status codes |
426
- | | | | 0x0 - success |
427
- | | | | 0x100 - error caused by NFIT update while |
428
- | status | 4 | 4 | read by _FIT wasn't completed, other |
429
- | | | | codes follow Chapter 3 in DSM Spec Rev1 |
430
- +----------+-----------------+-------------------------------------------+
431
- | fit data | Varies | 8 | contains FIT data, this field is present |
432
- | | | | if status field is 0; |
433
- +----------+--------+--------+-------------------------------------------+
434
-
435
- The FIT offset is maintained by the OSPM itself, current offset plus
436
- the size of the fit data returned by the function is the next offset
437
- OSPM should read. When all FIT data has been read out, zero fit data
438
- size is returned.
439
-
440
- If it returns status code 0x100, OSPM should restart to read FIT (read
441
- from offset 0 again).
442
diff --git a/docs/specs/index.rst b/docs/specs/index.rst
14
index XXXXXXX..XXXXXXX 100644
443
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/neon-dp.decode
444
--- a/docs/specs/index.rst
16
+++ b/target/arm/neon-dp.decode
445
+++ b/docs/specs/index.rst
17
@@ -XXX,XX +XXX,XX @@ VBSL_3s 1111 001 1 0 . 01 .... .... 0001 ... 1 .... @3same_logic
446
@@ -XXX,XX +XXX,XX @@ guest hardware that is specific to QEMU.
18
VBIT_3s 1111 001 1 0 . 10 .... .... 0001 ... 1 .... @3same_logic
447
acpi_cpu_hotplug
19
VBIF_3s 1111 001 1 0 . 11 .... .... 0001 ... 1 .... @3same_logic
448
acpi_mem_hotplug
20
449
acpi_pci_hotplug
21
+VCGT_S_3s 1111 001 0 0 . .. .... .... 0011 . . . 0 .... @3same
450
+ acpi_nvdimm
22
+VCGT_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 0 .... @3same
23
+VCGE_S_3s 1111 001 0 0 . .. .... .... 0011 . . . 1 .... @3same
24
+VCGE_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 1 .... @3same
25
+
26
VMAX_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 0 .... @3same
27
VMAX_U_3s 1111 001 1 0 . .. .... .... 0110 . . . 0 .... @3same
28
VMIN_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 1 .... @3same
29
@@ -XXX,XX +XXX,XX @@ VMIN_U_3s 1111 001 1 0 . .. .... .... 0110 . . . 1 .... @3same
30
31
VADD_3s 1111 001 0 0 . .. .... .... 1000 . . . 0 .... @3same
32
VSUB_3s 1111 001 1 0 . .. .... .... 1000 . . . 0 .... @3same
33
+
34
+VTST_3s 1111 001 0 0 . .. .... .... 1000 . . . 1 .... @3same
35
+VCEQ_3s 1111 001 1 0 . .. .... .... 1000 . . . 1 .... @3same
36
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
37
index XXXXXXX..XXXXXXX 100644
38
--- a/target/arm/translate-neon.inc.c
39
+++ b/target/arm/translate-neon.inc.c
40
@@ -XXX,XX +XXX,XX @@ DO_3SAME_NO_SZ_3(VMAX_S, tcg_gen_gvec_smax)
41
DO_3SAME_NO_SZ_3(VMAX_U, tcg_gen_gvec_umax)
42
DO_3SAME_NO_SZ_3(VMIN_S, tcg_gen_gvec_smin)
43
DO_3SAME_NO_SZ_3(VMIN_U, tcg_gen_gvec_umin)
44
+
45
+#define DO_3SAME_CMP(INSN, COND) \
46
+ static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \
47
+ uint32_t rn_ofs, uint32_t rm_ofs, \
48
+ uint32_t oprsz, uint32_t maxsz) \
49
+ { \
50
+ tcg_gen_gvec_cmp(COND, vece, rd_ofs, rn_ofs, rm_ofs, oprsz, maxsz); \
51
+ } \
52
+ DO_3SAME_NO_SZ_3(INSN, gen_##INSN##_3s)
53
+
54
+DO_3SAME_CMP(VCGT_S, TCG_COND_GT)
55
+DO_3SAME_CMP(VCGT_U, TCG_COND_GTU)
56
+DO_3SAME_CMP(VCGE_S, TCG_COND_GE)
57
+DO_3SAME_CMP(VCGE_U, TCG_COND_GEU)
58
+DO_3SAME_CMP(VCEQ, TCG_COND_EQ)
59
+
60
+static void gen_VTST_3s(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs,
61
+ uint32_t rm_ofs, uint32_t oprsz, uint32_t maxsz)
62
+{
63
+ tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs, oprsz, maxsz, &cmtst_op[vece]);
64
+}
65
+DO_3SAME_NO_SZ_3(VTST, gen_VTST_3s)
66
diff --git a/target/arm/translate.c b/target/arm/translate.c
67
index XXXXXXX..XXXXXXX 100644
68
--- a/target/arm/translate.c
69
+++ b/target/arm/translate.c
70
@@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
71
u ? &mls_op[size] : &mla_op[size]);
72
return 0;
73
74
- case NEON_3R_VTST_VCEQ:
75
- if (u) { /* VCEQ */
76
- tcg_gen_gvec_cmp(TCG_COND_EQ, size, rd_ofs, rn_ofs, rm_ofs,
77
- vec_size, vec_size);
78
- } else { /* VTST */
79
- tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs,
80
- vec_size, vec_size, &cmtst_op[size]);
81
- }
82
- return 0;
83
-
84
- case NEON_3R_VCGT:
85
- tcg_gen_gvec_cmp(u ? TCG_COND_GTU : TCG_COND_GT, size,
86
- rd_ofs, rn_ofs, rm_ofs, vec_size, vec_size);
87
- return 0;
88
-
89
- case NEON_3R_VCGE:
90
- tcg_gen_gvec_cmp(u ? TCG_COND_GEU : TCG_COND_GE, size,
91
- rd_ofs, rn_ofs, rm_ofs, vec_size, vec_size);
92
- return 0;
93
-
94
case NEON_3R_VSHL:
95
/* Note the operation is vshl vd,vm,vn */
96
tcg_gen_gvec_3(rd_ofs, rm_ofs, rn_ofs, vec_size, vec_size,
97
@@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
98
case NEON_3R_LOGIC:
99
case NEON_3R_VMAX:
100
case NEON_3R_VMIN:
101
+ case NEON_3R_VTST_VCEQ:
102
+ case NEON_3R_VCGT:
103
+ case NEON_3R_VCGE:
104
/* Already handled by decodetree */
105
return 1;
106
}
107
--
451
--
108
2.20.1
452
2.20.1
109
453
110
454
diff view generated by jsdifflib
1
Convert the Neon 3-reg-same VMAX and VMIN insns to decodetree.
1
Add entries for the ACPI specs documents in docs/specs to
2
appropriate sections of MAINTAINERS.
2
3
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
5
Message-id: 20200430181003.21682-17-peter.maydell@linaro.org
6
Message-id: 20210727170414.3368-6-peter.maydell@linaro.org
6
---
7
---
7
target/arm/neon-dp.decode | 5 +++++
8
MAINTAINERS | 5 +++++
8
target/arm/translate-neon.inc.c | 14 ++++++++++++++
9
1 file changed, 5 insertions(+)
9
target/arm/translate.c | 21 ++-------------------
10
3 files changed, 21 insertions(+), 19 deletions(-)
11
10
12
diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode
11
diff --git a/MAINTAINERS b/MAINTAINERS
13
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
14
--- a/target/arm/neon-dp.decode
13
--- a/MAINTAINERS
15
+++ b/target/arm/neon-dp.decode
14
+++ b/MAINTAINERS
16
@@ -XXX,XX +XXX,XX @@ VBSL_3s 1111 001 1 0 . 01 .... .... 0001 ... 1 .... @3same_logic
15
@@ -XXX,XX +XXX,XX @@ F: qapi/acpi.json
17
VBIT_3s 1111 001 1 0 . 10 .... .... 0001 ... 1 .... @3same_logic
16
F: tests/qtest/bios-tables-test*
18
VBIF_3s 1111 001 1 0 . 11 .... .... 0001 ... 1 .... @3same_logic
17
F: tests/qtest/acpi-utils.[hc]
19
18
F: tests/data/acpi/
20
+VMAX_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 0 .... @3same
19
+F: docs/specs/acpi_cpu_hotplug.rst
21
+VMAX_U_3s 1111 001 1 0 . .. .... .... 0110 . . . 0 .... @3same
20
+F: docs/specs/acpi_mem_hotplug.rst
22
+VMIN_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 1 .... @3same
21
+F: docs/specs/acpi_pci_hotplug.rst
23
+VMIN_U_3s 1111 001 1 0 . .. .... .... 0110 . . . 1 .... @3same
22
+F: docs/specs/acpi_hw_reduced_hotplug.rst
24
+
23
25
VADD_3s 1111 001 0 0 . .. .... .... 1000 . . . 0 .... @3same
24
ACPI/HEST/GHES
26
VSUB_3s 1111 001 1 0 . .. .... .... 1000 . . . 0 .... @3same
25
R: Dongjiu Geng <gengdongjiu1@gmail.com>
27
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
26
@@ -XXX,XX +XXX,XX @@ F: hw/acpi/nvdimm.c
28
index XXXXXXX..XXXXXXX 100644
27
F: hw/mem/nvdimm.c
29
--- a/target/arm/translate-neon.inc.c
28
F: include/hw/mem/nvdimm.h
30
+++ b/target/arm/translate-neon.inc.c
29
F: docs/nvdimm.txt
31
@@ -XXX,XX +XXX,XX @@ DO_3SAME(VEOR, tcg_gen_gvec_xor)
30
+F: docs/specs/acpi_nvdimm.rst
32
DO_3SAME_BITSEL(VBSL, rd_ofs, rn_ofs, rm_ofs)
31
33
DO_3SAME_BITSEL(VBIT, rm_ofs, rn_ofs, rd_ofs)
32
e1000x
34
DO_3SAME_BITSEL(VBIF, rm_ofs, rd_ofs, rn_ofs)
33
M: Dmitry Fleytman <dmitry.fleytman@gmail.com>
35
+
36
+#define DO_3SAME_NO_SZ_3(INSN, FUNC) \
37
+ static bool trans_##INSN##_3s(DisasContext *s, arg_3same *a) \
38
+ { \
39
+ if (a->size == 3) { \
40
+ return false; \
41
+ } \
42
+ return do_3same(s, a, FUNC); \
43
+ }
44
+
45
+DO_3SAME_NO_SZ_3(VMAX_S, tcg_gen_gvec_smax)
46
+DO_3SAME_NO_SZ_3(VMAX_U, tcg_gen_gvec_umax)
47
+DO_3SAME_NO_SZ_3(VMIN_S, tcg_gen_gvec_smin)
48
+DO_3SAME_NO_SZ_3(VMIN_U, tcg_gen_gvec_umin)
49
diff --git a/target/arm/translate.c b/target/arm/translate.c
50
index XXXXXXX..XXXXXXX 100644
51
--- a/target/arm/translate.c
52
+++ b/target/arm/translate.c
53
@@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
54
rd_ofs, rn_ofs, rm_ofs, vec_size, vec_size);
55
return 0;
56
57
- case NEON_3R_VMAX:
58
- if (u) {
59
- tcg_gen_gvec_umax(size, rd_ofs, rn_ofs, rm_ofs,
60
- vec_size, vec_size);
61
- } else {
62
- tcg_gen_gvec_smax(size, rd_ofs, rn_ofs, rm_ofs,
63
- vec_size, vec_size);
64
- }
65
- return 0;
66
- case NEON_3R_VMIN:
67
- if (u) {
68
- tcg_gen_gvec_umin(size, rd_ofs, rn_ofs, rm_ofs,
69
- vec_size, vec_size);
70
- } else {
71
- tcg_gen_gvec_smin(size, rd_ofs, rn_ofs, rm_ofs,
72
- vec_size, vec_size);
73
- }
74
- return 0;
75
-
76
case NEON_3R_VSHL:
77
/* Note the operation is vshl vd,vm,vn */
78
tcg_gen_gvec_3(rd_ofs, rm_ofs, rn_ofs, vec_size, vec_size,
79
@@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
80
81
case NEON_3R_VADD_VSUB:
82
case NEON_3R_LOGIC:
83
+ case NEON_3R_VMAX:
84
+ case NEON_3R_VMIN:
85
/* Already handled by decodetree */
86
return 1;
87
}
88
--
34
--
89
2.20.1
35
2.20.1
90
36
91
37
diff view generated by jsdifflib
1
Convert the Neon logic ops in the 3-reg-same grouping to decodetree.
1
The xen_available() function is used only to produce an error
2
Note that for the logic ops the 'size' field forms part of their
2
for some Xen-specific command line options in QEMU binaries where
3
decode and the actual operations are always bitwise.
3
Xen support was not compiled in: it just returns the value of
4
the CONFIG_XEN define.
5
6
Now that accelerators are QOM classes, we can check for
7
"does this binary have Xen compiled in" with accel_find("xen"),
8
and drop the xen_available() function.
4
9
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20200430181003.21682-16-peter.maydell@linaro.org
12
Message-id: 20210730105947.28215-2-peter.maydell@linaro.org
8
---
13
---
9
target/arm/neon-dp.decode | 12 +++++++++++
14
include/sysemu/arch_init.h | 1 -
10
target/arm/translate-neon.inc.c | 19 +++++++++++++++++
15
softmmu/arch_init.c | 9 ---------
11
target/arm/translate.c | 38 +--------------------------------
16
softmmu/vl.c | 6 +++---
12
3 files changed, 32 insertions(+), 37 deletions(-)
17
3 files changed, 3 insertions(+), 13 deletions(-)
13
18
14
diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode
19
diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h
15
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/neon-dp.decode
21
--- a/include/sysemu/arch_init.h
17
+++ b/target/arm/neon-dp.decode
22
+++ b/include/sysemu/arch_init.h
18
@@ -XXX,XX +XXX,XX @@
23
@@ -XXX,XX +XXX,XX @@ enum {
19
@3same .... ... . . . size:2 .... .... .... . q:1 . . .... \
24
extern const uint32_t arch_type;
20
&3same vm=%vm_dp vn=%vn_dp vd=%vd_dp
25
21
26
int kvm_available(void);
22
+@3same_logic .... ... . . . .. .... .... .... . q:1 .. .... \
27
-int xen_available(void);
23
+ &3same vm=%vm_dp vn=%vn_dp vd=%vd_dp size=0
28
24
+
29
/* default virtio transport per architecture */
25
+VAND_3s 1111 001 0 0 . 00 .... .... 0001 ... 1 .... @3same_logic
30
#define QEMU_ARCH_VIRTIO_PCI (QEMU_ARCH_ALPHA | QEMU_ARCH_ARM | \
26
+VBIC_3s 1111 001 0 0 . 01 .... .... 0001 ... 1 .... @3same_logic
31
diff --git a/softmmu/arch_init.c b/softmmu/arch_init.c
27
+VORR_3s 1111 001 0 0 . 10 .... .... 0001 ... 1 .... @3same_logic
28
+VORN_3s 1111 001 0 0 . 11 .... .... 0001 ... 1 .... @3same_logic
29
+VEOR_3s 1111 001 1 0 . 00 .... .... 0001 ... 1 .... @3same_logic
30
+VBSL_3s 1111 001 1 0 . 01 .... .... 0001 ... 1 .... @3same_logic
31
+VBIT_3s 1111 001 1 0 . 10 .... .... 0001 ... 1 .... @3same_logic
32
+VBIF_3s 1111 001 1 0 . 11 .... .... 0001 ... 1 .... @3same_logic
33
+
34
VADD_3s 1111 001 0 0 . .. .... .... 1000 . . . 0 .... @3same
35
VSUB_3s 1111 001 1 0 . .. .... .... 1000 . . . 0 .... @3same
36
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
37
index XXXXXXX..XXXXXXX 100644
32
index XXXXXXX..XXXXXXX 100644
38
--- a/target/arm/translate-neon.inc.c
33
--- a/softmmu/arch_init.c
39
+++ b/target/arm/translate-neon.inc.c
34
+++ b/softmmu/arch_init.c
40
@@ -XXX,XX +XXX,XX @@ static bool do_3same(DisasContext *s, arg_3same *a, GVecGen3Fn fn)
35
@@ -XXX,XX +XXX,XX @@ int kvm_available(void)
41
36
return 0;
42
DO_3SAME(VADD, tcg_gen_gvec_add)
37
#endif
43
DO_3SAME(VSUB, tcg_gen_gvec_sub)
38
}
44
+DO_3SAME(VAND, tcg_gen_gvec_and)
39
-
45
+DO_3SAME(VBIC, tcg_gen_gvec_andc)
40
-int xen_available(void)
46
+DO_3SAME(VORR, tcg_gen_gvec_or)
41
-{
47
+DO_3SAME(VORN, tcg_gen_gvec_orc)
42
-#ifdef CONFIG_XEN
48
+DO_3SAME(VEOR, tcg_gen_gvec_xor)
43
- return 1;
49
+
44
-#else
50
+/* These insns are all gvec_bitsel but with the inputs in various orders. */
45
- return 0;
51
+#define DO_3SAME_BITSEL(INSN, O1, O2, O3) \
46
-#endif
52
+ static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \
47
-}
53
+ uint32_t rn_ofs, uint32_t rm_ofs, \
48
diff --git a/softmmu/vl.c b/softmmu/vl.c
54
+ uint32_t oprsz, uint32_t maxsz) \
55
+ { \
56
+ tcg_gen_gvec_bitsel(vece, rd_ofs, O1, O2, O3, oprsz, maxsz); \
57
+ } \
58
+ DO_3SAME(INSN, gen_##INSN##_3s)
59
+
60
+DO_3SAME_BITSEL(VBSL, rd_ofs, rn_ofs, rm_ofs)
61
+DO_3SAME_BITSEL(VBIT, rm_ofs, rn_ofs, rd_ofs)
62
+DO_3SAME_BITSEL(VBIF, rm_ofs, rd_ofs, rn_ofs)
63
diff --git a/target/arm/translate.c b/target/arm/translate.c
64
index XXXXXXX..XXXXXXX 100644
49
index XXXXXXX..XXXXXXX 100644
65
--- a/target/arm/translate.c
50
--- a/softmmu/vl.c
66
+++ b/target/arm/translate.c
51
+++ b/softmmu/vl.c
67
@@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
52
@@ -XXX,XX +XXX,XX @@ void qemu_init(int argc, char **argv, char **envp)
68
}
53
has_defaults = 0;
69
return 1;
54
break;
70
55
case QEMU_OPTION_xen_domid:
71
- case NEON_3R_LOGIC: /* Logic ops. */
56
- if (!(xen_available())) {
72
- switch ((u << 2) | size) {
57
+ if (!(accel_find("xen"))) {
73
- case 0: /* VAND */
58
error_report("Option not supported for this target");
74
- tcg_gen_gvec_and(0, rd_ofs, rn_ofs, rm_ofs,
59
exit(1);
75
- vec_size, vec_size);
60
}
76
- break;
61
xen_domid = atoi(optarg);
77
- case 1: /* VBIC */
62
break;
78
- tcg_gen_gvec_andc(0, rd_ofs, rn_ofs, rm_ofs,
63
case QEMU_OPTION_xen_attach:
79
- vec_size, vec_size);
64
- if (!(xen_available())) {
80
- break;
65
+ if (!(accel_find("xen"))) {
81
- case 2: /* VORR */
66
error_report("Option not supported for this target");
82
- tcg_gen_gvec_or(0, rd_ofs, rn_ofs, rm_ofs,
67
exit(1);
83
- vec_size, vec_size);
68
}
84
- break;
69
xen_mode = XEN_ATTACH;
85
- case 3: /* VORN */
70
break;
86
- tcg_gen_gvec_orc(0, rd_ofs, rn_ofs, rm_ofs,
71
case QEMU_OPTION_xen_domid_restrict:
87
- vec_size, vec_size);
72
- if (!(xen_available())) {
88
- break;
73
+ if (!(accel_find("xen"))) {
89
- case 4: /* VEOR */
74
error_report("Option not supported for this target");
90
- tcg_gen_gvec_xor(0, rd_ofs, rn_ofs, rm_ofs,
75
exit(1);
91
- vec_size, vec_size);
76
}
92
- break;
93
- case 5: /* VBSL */
94
- tcg_gen_gvec_bitsel(MO_8, rd_ofs, rd_ofs, rn_ofs, rm_ofs,
95
- vec_size, vec_size);
96
- break;
97
- case 6: /* VBIT */
98
- tcg_gen_gvec_bitsel(MO_8, rd_ofs, rm_ofs, rn_ofs, rd_ofs,
99
- vec_size, vec_size);
100
- break;
101
- case 7: /* VBIF */
102
- tcg_gen_gvec_bitsel(MO_8, rd_ofs, rm_ofs, rd_ofs, rn_ofs,
103
- vec_size, vec_size);
104
- break;
105
- }
106
- return 0;
107
-
108
case NEON_3R_VQADD:
109
tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc),
110
rn_ofs, rm_ofs, vec_size, vec_size,
111
@@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
112
return 0;
113
114
case NEON_3R_VADD_VSUB:
115
+ case NEON_3R_LOGIC:
116
/* Already handled by decodetree */
117
return 1;
118
}
119
--
77
--
120
2.20.1
78
2.20.1
121
79
122
80
diff view generated by jsdifflib
1
Convert the Neon 3-reg-same VADD and VSUB insns to decodetree.
1
The kvm_available() function reports whether KVM support was
2
compiled into the QEMU binary; it returns the value of the
3
CONFIG_KVM define.
2
4
3
Note that we don't need the neon_3r_sizes[op] check here because all
5
The only place in the codebase where we use this function is
4
size values are OK for VADD and VSUB; we'll add this when we convert
6
in qmp_query_kvm(). Now that accelerators are based on QOM
5
the first insn that has size restrictions.
7
classes we can instead use accel_find("kvm") and remove the
6
8
kvm_available() function.
7
For this we need one of the GVecGen*Fn typedefs currently in
8
translate-a64.h; move them all to translate.h as a block so they
9
are visible to the 32-bit decoder.
10
9
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
13
Message-id: 20200430181003.21682-15-peter.maydell@linaro.org
12
Message-id: 20210730105947.28215-3-peter.maydell@linaro.org
14
---
13
---
15
target/arm/translate-a64.h | 9 --------
14
include/sysemu/arch_init.h | 2 --
16
target/arm/translate.h | 9 ++++++++
15
monitor/qmp-cmds.c | 2 +-
17
target/arm/neon-dp.decode | 17 +++++++++++++++
16
softmmu/arch_init.c | 9 ---------
18
target/arm/translate-neon.inc.c | 38 +++++++++++++++++++++++++++++++++
17
3 files changed, 1 insertion(+), 12 deletions(-)
19
target/arm/translate.c | 14 ++++--------
20
5 files changed, 68 insertions(+), 19 deletions(-)
21
18
22
diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h
19
diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h
23
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
24
--- a/target/arm/translate-a64.h
21
--- a/include/sysemu/arch_init.h
25
+++ b/target/arm/translate-a64.h
22
+++ b/include/sysemu/arch_init.h
26
@@ -XXX,XX +XXX,XX @@ static inline int vec_full_reg_size(DisasContext *s)
23
@@ -XXX,XX +XXX,XX @@ enum {
27
24
28
bool disas_sve(DisasContext *, uint32_t);
25
extern const uint32_t arch_type;
29
26
30
-/* Note that the gvec expanders operate on offsets + sizes. */
27
-int kvm_available(void);
31
-typedef void GVecGen2Fn(unsigned, uint32_t, uint32_t, uint32_t, uint32_t);
32
-typedef void GVecGen2iFn(unsigned, uint32_t, uint32_t, int64_t,
33
- uint32_t, uint32_t);
34
-typedef void GVecGen3Fn(unsigned, uint32_t, uint32_t,
35
- uint32_t, uint32_t, uint32_t);
36
-typedef void GVecGen4Fn(unsigned, uint32_t, uint32_t, uint32_t,
37
- uint32_t, uint32_t, uint32_t);
38
-
28
-
39
#endif /* TARGET_ARM_TRANSLATE_A64_H */
29
/* default virtio transport per architecture */
40
diff --git a/target/arm/translate.h b/target/arm/translate.h
30
#define QEMU_ARCH_VIRTIO_PCI (QEMU_ARCH_ALPHA | QEMU_ARCH_ARM | \
31
QEMU_ARCH_HPPA | QEMU_ARCH_I386 | \
32
diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c
41
index XXXXXXX..XXXXXXX 100644
33
index XXXXXXX..XXXXXXX 100644
42
--- a/target/arm/translate.h
34
--- a/monitor/qmp-cmds.c
43
+++ b/target/arm/translate.h
35
+++ b/monitor/qmp-cmds.c
44
@@ -XXX,XX +XXX,XX @@ void gen_sshl_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b);
36
@@ -XXX,XX +XXX,XX @@ KvmInfo *qmp_query_kvm(Error **errp)
45
#define dc_isar_feature(name, ctx) \
37
KvmInfo *info = g_malloc0(sizeof(*info));
46
({ DisasContext *ctx_ = (ctx); isar_feature_##name(ctx_->isar); })
38
47
39
info->enabled = kvm_enabled();
48
+/* Note that the gvec expanders operate on offsets + sizes. */
40
- info->present = kvm_available();
49
+typedef void GVecGen2Fn(unsigned, uint32_t, uint32_t, uint32_t, uint32_t);
41
+ info->present = accel_find("kvm");
50
+typedef void GVecGen2iFn(unsigned, uint32_t, uint32_t, int64_t,
42
51
+ uint32_t, uint32_t);
43
return info;
52
+typedef void GVecGen3Fn(unsigned, uint32_t, uint32_t,
44
}
53
+ uint32_t, uint32_t, uint32_t);
45
diff --git a/softmmu/arch_init.c b/softmmu/arch_init.c
54
+typedef void GVecGen4Fn(unsigned, uint32_t, uint32_t, uint32_t,
55
+ uint32_t, uint32_t, uint32_t);
56
+
57
#endif /* TARGET_ARM_TRANSLATE_H */
58
diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode
59
index XXXXXXX..XXXXXXX 100644
46
index XXXXXXX..XXXXXXX 100644
60
--- a/target/arm/neon-dp.decode
47
--- a/softmmu/arch_init.c
61
+++ b/target/arm/neon-dp.decode
48
+++ b/softmmu/arch_init.c
62
@@ -XXX,XX +XXX,XX @@
49
@@ -XXX,XX +XXX,XX @@ int graphic_depth = 32;
63
#
50
#endif
64
# This file is processed by scripts/decodetree.py
51
65
#
52
const uint32_t arch_type = QEMU_ARCH;
66
+# VFP/Neon register fields; same as vfp.decode
67
+%vm_dp 5:1 0:4
68
+%vn_dp 7:1 16:4
69
+%vd_dp 22:1 12:4
70
71
# Encodings for Neon data processing instructions where the T32 encoding
72
# is a simple transformation of the A32 encoding.
73
@@ -XXX,XX +XXX,XX @@
74
# 0b111p_1111_qqqq_qqqq_qqqq_qqqq_qqqq_qqqq
75
# This file works on the A32 encoding only; calling code for T32 has to
76
# transform the insn into the A32 version first.
77
+
78
+######################################################################
79
+# 3-reg-same grouping:
80
+# 1111 001 U 0 D sz:2 Vn:4 Vd:4 opc:4 N Q M op Vm:4
81
+######################################################################
82
+
83
+&3same vm vn vd q size
84
+
85
+@3same .... ... . . . size:2 .... .... .... . q:1 . . .... \
86
+ &3same vm=%vm_dp vn=%vn_dp vd=%vd_dp
87
+
88
+VADD_3s 1111 001 0 0 . .. .... .... 1000 . . . 0 .... @3same
89
+VSUB_3s 1111 001 1 0 . .. .... .... 1000 . . . 0 .... @3same
90
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
91
index XXXXXXX..XXXXXXX 100644
92
--- a/target/arm/translate-neon.inc.c
93
+++ b/target/arm/translate-neon.inc.c
94
@@ -XXX,XX +XXX,XX @@ static bool trans_VLDST_single(DisasContext *s, arg_VLDST_single *a)
95
96
return true;
97
}
98
+
99
+static bool do_3same(DisasContext *s, arg_3same *a, GVecGen3Fn fn)
100
+{
101
+ int vec_size = a->q ? 16 : 8;
102
+ int rd_ofs = neon_reg_offset(a->vd, 0);
103
+ int rn_ofs = neon_reg_offset(a->vn, 0);
104
+ int rm_ofs = neon_reg_offset(a->vm, 0);
105
+
106
+ if (!arm_dc_feature(s, ARM_FEATURE_NEON)) {
107
+ return false;
108
+ }
109
+
110
+ /* UNDEF accesses to D16-D31 if they don't exist. */
111
+ if (!dc_isar_feature(aa32_simd_r32, s) &&
112
+ ((a->vd | a->vn | a->vm) & 0x10)) {
113
+ return false;
114
+ }
115
+
116
+ if ((a->vn | a->vm | a->vd) & a->q) {
117
+ return false;
118
+ }
119
+
120
+ if (!vfp_access_check(s)) {
121
+ return true;
122
+ }
123
+
124
+ fn(a->size, rd_ofs, rn_ofs, rm_ofs, vec_size, vec_size);
125
+ return true;
126
+}
127
+
128
+#define DO_3SAME(INSN, FUNC) \
129
+ static bool trans_##INSN##_3s(DisasContext *s, arg_3same *a) \
130
+ { \
131
+ return do_3same(s, a, FUNC); \
132
+ }
133
+
134
+DO_3SAME(VADD, tcg_gen_gvec_add)
135
+DO_3SAME(VSUB, tcg_gen_gvec_sub)
136
diff --git a/target/arm/translate.c b/target/arm/translate.c
137
index XXXXXXX..XXXXXXX 100644
138
--- a/target/arm/translate.c
139
+++ b/target/arm/translate.c
140
@@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
141
}
142
return 0;
143
144
- case NEON_3R_VADD_VSUB:
145
- if (u) {
146
- tcg_gen_gvec_sub(size, rd_ofs, rn_ofs, rm_ofs,
147
- vec_size, vec_size);
148
- } else {
149
- tcg_gen_gvec_add(size, rd_ofs, rn_ofs, rm_ofs,
150
- vec_size, vec_size);
151
- }
152
- return 0;
153
-
53
-
154
case NEON_3R_VQADD:
54
-int kvm_available(void)
155
tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc),
55
-{
156
rn_ofs, rm_ofs, vec_size, vec_size,
56
-#ifdef CONFIG_KVM
157
@@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
57
- return 1;
158
tcg_gen_gvec_3(rd_ofs, rm_ofs, rn_ofs, vec_size, vec_size,
58
-#else
159
u ? &ushl_op[size] : &sshl_op[size]);
59
- return 0;
160
return 0;
60
-#endif
161
+
61
-}
162
+ case NEON_3R_VADD_VSUB:
163
+ /* Already handled by decodetree */
164
+ return 1;
165
}
166
167
if (size == 3) {
168
--
62
--
169
2.20.1
63
2.20.1
170
64
171
65
diff view generated by jsdifflib
1
Convert the Neon "load single structure to all lanes" insns to
1
arch_init.c does very little but has a long list of #include lines.
2
decodetree.
2
Remove all the unnecessary ones.
3
3
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20200430181003.21682-13-peter.maydell@linaro.org
6
Message-id: 20210730105947.28215-4-peter.maydell@linaro.org
7
---
7
---
8
target/arm/neon-ls.decode | 5 +++
8
softmmu/arch_init.c | 7 -------
9
target/arm/translate-neon.inc.c | 73 +++++++++++++++++++++++++++++++++
9
1 file changed, 7 deletions(-)
10
target/arm/translate.c | 55 +------------------------
11
3 files changed, 80 insertions(+), 53 deletions(-)
12
10
13
diff --git a/target/arm/neon-ls.decode b/target/arm/neon-ls.decode
11
diff --git a/softmmu/arch_init.c b/softmmu/arch_init.c
14
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/neon-ls.decode
13
--- a/softmmu/arch_init.c
16
+++ b/target/arm/neon-ls.decode
14
+++ b/softmmu/arch_init.c
17
@@ -XXX,XX +XXX,XX @@
15
@@ -XXX,XX +XXX,XX @@
18
16
*/
19
VLDST_multiple 1111 0100 0 . l:1 0 rn:4 .... itype:4 size:2 align:2 rm:4 \
17
#include "qemu/osdep.h"
20
vd=%vd_dp
18
#include "sysemu/arch_init.h"
21
+
19
-#include "hw/pci/pci.h"
22
+# Neon load single element to all lanes
20
-#include "hw/audio/soundhw.h"
23
+
21
-#include "qapi/error.h"
24
+VLD_all_lanes 1111 0100 1 . 1 0 rn:4 .... 11 n:2 size:2 t:1 a:1 rm:4 \
22
-#include "qemu/config-file.h"
25
+ vd=%vd_dp
23
-#include "qemu/error-report.h"
26
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
24
-#include "hw/acpi/acpi.h"
27
index XXXXXXX..XXXXXXX 100644
25
-#include "qemu/help_option.h"
28
--- a/target/arm/translate-neon.inc.c
26
29
+++ b/target/arm/translate-neon.inc.c
27
#ifdef TARGET_SPARC
30
@@ -XXX,XX +XXX,XX @@ static bool trans_VLDST_multiple(DisasContext *s, arg_VLDST_multiple *a)
28
int graphic_width = 1024;
31
gen_neon_ldst_base_update(s, a->rm, a->rn, nregs * interleave * 8);
32
return true;
33
}
34
+
35
+static bool trans_VLD_all_lanes(DisasContext *s, arg_VLD_all_lanes *a)
36
+{
37
+ /* Neon load single structure to all lanes */
38
+ int reg, stride, vec_size;
39
+ int vd = a->vd;
40
+ int size = a->size;
41
+ int nregs = a->n + 1;
42
+ TCGv_i32 addr, tmp;
43
+
44
+ if (!arm_dc_feature(s, ARM_FEATURE_NEON)) {
45
+ return false;
46
+ }
47
+
48
+ /* UNDEF accesses to D16-D31 if they don't exist */
49
+ if (!dc_isar_feature(aa32_simd_r32, s) && (a->vd & 0x10)) {
50
+ return false;
51
+ }
52
+
53
+ if (size == 3) {
54
+ if (nregs != 4 || a->a == 0) {
55
+ return false;
56
+ }
57
+ /* For VLD4 size == 3 a == 1 means 32 bits at 16 byte alignment */
58
+ size = 2;
59
+ }
60
+ if (nregs == 1 && a->a == 1 && size == 0) {
61
+ return false;
62
+ }
63
+ if (nregs == 3 && a->a == 1) {
64
+ return false;
65
+ }
66
+
67
+ if (!vfp_access_check(s)) {
68
+ return true;
69
+ }
70
+
71
+ /*
72
+ * VLD1 to all lanes: T bit indicates how many Dregs to write.
73
+ * VLD2/3/4 to all lanes: T bit indicates register stride.
74
+ */
75
+ stride = a->t ? 2 : 1;
76
+ vec_size = nregs == 1 ? stride * 8 : 8;
77
+
78
+ tmp = tcg_temp_new_i32();
79
+ addr = tcg_temp_new_i32();
80
+ load_reg_var(s, addr, a->rn);
81
+ for (reg = 0; reg < nregs; reg++) {
82
+ gen_aa32_ld_i32(s, tmp, addr, get_mem_index(s),
83
+ s->be_data | size);
84
+ if ((vd & 1) && vec_size == 16) {
85
+ /*
86
+ * We cannot write 16 bytes at once because the
87
+ * destination is unaligned.
88
+ */
89
+ tcg_gen_gvec_dup_i32(size, neon_reg_offset(vd, 0),
90
+ 8, 8, tmp);
91
+ tcg_gen_gvec_mov(0, neon_reg_offset(vd + 1, 0),
92
+ neon_reg_offset(vd, 0), 8, 8);
93
+ } else {
94
+ tcg_gen_gvec_dup_i32(size, neon_reg_offset(vd, 0),
95
+ vec_size, vec_size, tmp);
96
+ }
97
+ tcg_gen_addi_i32(addr, addr, 1 << size);
98
+ vd += stride;
99
+ }
100
+ tcg_temp_free_i32(tmp);
101
+ tcg_temp_free_i32(addr);
102
+
103
+ gen_neon_ldst_base_update(s, a->rm, a->rn, (1 << size) * nregs);
104
+
105
+ return true;
106
+}
107
diff --git a/target/arm/translate.c b/target/arm/translate.c
108
index XXXXXXX..XXXXXXX 100644
109
--- a/target/arm/translate.c
110
+++ b/target/arm/translate.c
111
@@ -XXX,XX +XXX,XX @@ static int disas_neon_ls_insn(DisasContext *s, uint32_t insn)
112
int size;
113
int reg;
114
int load;
115
- int vec_size;
116
TCGv_i32 addr;
117
TCGv_i32 tmp;
118
119
@@ -XXX,XX +XXX,XX @@ static int disas_neon_ls_insn(DisasContext *s, uint32_t insn)
120
} else {
121
size = (insn >> 10) & 3;
122
if (size == 3) {
123
- /* Load single element to all lanes. */
124
- int a = (insn >> 4) & 1;
125
- if (!load) {
126
- return 1;
127
- }
128
- size = (insn >> 6) & 3;
129
- nregs = ((insn >> 8) & 3) + 1;
130
-
131
- if (size == 3) {
132
- if (nregs != 4 || a == 0) {
133
- return 1;
134
- }
135
- /* For VLD4 size==3 a == 1 means 32 bits at 16 byte alignment */
136
- size = 2;
137
- }
138
- if (nregs == 1 && a == 1 && size == 0) {
139
- return 1;
140
- }
141
- if (nregs == 3 && a == 1) {
142
- return 1;
143
- }
144
- addr = tcg_temp_new_i32();
145
- load_reg_var(s, addr, rn);
146
-
147
- /* VLD1 to all lanes: bit 5 indicates how many Dregs to write.
148
- * VLD2/3/4 to all lanes: bit 5 indicates register stride.
149
- */
150
- stride = (insn & (1 << 5)) ? 2 : 1;
151
- vec_size = nregs == 1 ? stride * 8 : 8;
152
-
153
- tmp = tcg_temp_new_i32();
154
- for (reg = 0; reg < nregs; reg++) {
155
- gen_aa32_ld_i32(s, tmp, addr, get_mem_index(s),
156
- s->be_data | size);
157
- if ((rd & 1) && vec_size == 16) {
158
- /* We cannot write 16 bytes at once because the
159
- * destination is unaligned.
160
- */
161
- tcg_gen_gvec_dup_i32(size, neon_reg_offset(rd, 0),
162
- 8, 8, tmp);
163
- tcg_gen_gvec_mov(0, neon_reg_offset(rd + 1, 0),
164
- neon_reg_offset(rd, 0), 8, 8);
165
- } else {
166
- tcg_gen_gvec_dup_i32(size, neon_reg_offset(rd, 0),
167
- vec_size, vec_size, tmp);
168
- }
169
- tcg_gen_addi_i32(addr, addr, 1 << size);
170
- rd += stride;
171
- }
172
- tcg_temp_free_i32(tmp);
173
- tcg_temp_free_i32(addr);
174
- stride = (1 << size) * nregs;
175
+ /* Load single element to all lanes -- handled by decodetree */
176
+ return 1;
177
} else {
178
/* Single element. */
179
int idx = (insn >> 4) & 0xf;
180
--
29
--
181
2.20.1
30
2.20.1
182
31
183
32
diff view generated by jsdifflib
1
Convert the Neon "load/store single structure to one lane" insns to
1
Instead of using an ifdef ladder in arch_init.c (which we then have
2
decodetree.
2
to manually update every time we add or remove a target
3
3
architecture), have meson.build put "#define QEMU_ARCH QEMU_ARCH_FOO"
4
As this is the last set of insns in the neon load/store group,
4
in the config-target.h file.
5
we can remove the whole disas_neon_ls_insn() function.
6
5
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20200430181003.21682-14-peter.maydell@linaro.org
9
Message-id: 20210730105947.28215-5-peter.maydell@linaro.org
10
---
10
---
11
target/arm/neon-ls.decode | 11 +++
11
meson.build | 2 ++
12
target/arm/translate-neon.inc.c | 89 +++++++++++++++++++
12
softmmu/arch_init.c | 41 -----------------------------------------
13
target/arm/translate.c | 147 --------------------------------
13
2 files changed, 2 insertions(+), 41 deletions(-)
14
3 files changed, 100 insertions(+), 147 deletions(-)
15
14
16
diff --git a/target/arm/neon-ls.decode b/target/arm/neon-ls.decode
15
diff --git a/meson.build b/meson.build
17
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/neon-ls.decode
17
--- a/meson.build
19
+++ b/target/arm/neon-ls.decode
18
+++ b/meson.build
20
@@ -XXX,XX +XXX,XX @@ VLDST_multiple 1111 0100 0 . l:1 0 rn:4 .... itype:4 size:2 align:2 rm:4 \
19
@@ -XXX,XX +XXX,XX @@ foreach target : target_dirs
21
20
config_target_data.set(k, v)
22
VLD_all_lanes 1111 0100 1 . 1 0 rn:4 .... 11 n:2 size:2 t:1 a:1 rm:4 \
21
endif
23
vd=%vd_dp
22
endforeach
24
+
23
+ config_target_data.set('QEMU_ARCH',
25
+# Neon load/store single structure to one lane
24
+ 'QEMU_ARCH_' + config_target['TARGET_BASE_ARCH'].to_upper())
26
+%imm1_5_p1 5:1 !function=plus1
25
config_target_h += {target: configure_file(output: target + '-config-target.h',
27
+%imm1_6_p1 6:1 !function=plus1
26
configuration: config_target_data)}
28
+
27
29
+VLDST_single 1111 0100 1 . l:1 0 rn:4 .... 00 n:2 reg_idx:3 align:1 rm:4 \
28
diff --git a/softmmu/arch_init.c b/softmmu/arch_init.c
30
+ vd=%vd_dp size=0 stride=1
31
+VLDST_single 1111 0100 1 . l:1 0 rn:4 .... 01 n:2 reg_idx:2 align:2 rm:4 \
32
+ vd=%vd_dp size=1 stride=%imm1_5_p1
33
+VLDST_single 1111 0100 1 . l:1 0 rn:4 .... 10 n:2 reg_idx:1 align:3 rm:4 \
34
+ vd=%vd_dp size=2 stride=%imm1_6_p1
35
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
36
index XXXXXXX..XXXXXXX 100644
29
index XXXXXXX..XXXXXXX 100644
37
--- a/target/arm/translate-neon.inc.c
30
--- a/softmmu/arch_init.c
38
+++ b/target/arm/translate-neon.inc.c
31
+++ b/softmmu/arch_init.c
39
@@ -XXX,XX +XXX,XX @@
32
@@ -XXX,XX +XXX,XX @@ int graphic_height = 600;
40
* It might be possible to convert it to a standalone .c file eventually.
33
int graphic_depth = 32;
41
*/
34
#endif
42
43
+static inline int plus1(DisasContext *s, int x)
44
+{
45
+ return x + 1;
46
+}
47
+
48
/* Include the generated Neon decoder */
49
#include "decode-neon-dp.inc.c"
50
#include "decode-neon-ls.inc.c"
51
@@ -XXX,XX +XXX,XX @@ static bool trans_VLD_all_lanes(DisasContext *s, arg_VLD_all_lanes *a)
52
53
return true;
54
}
55
+
56
+static bool trans_VLDST_single(DisasContext *s, arg_VLDST_single *a)
57
+{
58
+ /* Neon load/store single structure to one lane */
59
+ int reg;
60
+ int nregs = a->n + 1;
61
+ int vd = a->vd;
62
+ TCGv_i32 addr, tmp;
63
+
64
+ if (!arm_dc_feature(s, ARM_FEATURE_NEON)) {
65
+ return false;
66
+ }
67
+
68
+ /* UNDEF accesses to D16-D31 if they don't exist */
69
+ if (!dc_isar_feature(aa32_simd_r32, s) && (a->vd & 0x10)) {
70
+ return false;
71
+ }
72
+
73
+ /* Catch the UNDEF cases. This is unavoidably a bit messy. */
74
+ switch (nregs) {
75
+ case 1:
76
+ if (((a->align & (1 << a->size)) != 0) ||
77
+ (a->size == 2 && ((a->align & 3) == 1 || (a->align & 3) == 2))) {
78
+ return false;
79
+ }
80
+ break;
81
+ case 3:
82
+ if ((a->align & 1) != 0) {
83
+ return false;
84
+ }
85
+ /* fall through */
86
+ case 2:
87
+ if (a->size == 2 && (a->align & 2) != 0) {
88
+ return false;
89
+ }
90
+ break;
91
+ case 4:
92
+ if ((a->size == 2) && ((a->align & 3) == 3)) {
93
+ return false;
94
+ }
95
+ break;
96
+ default:
97
+ abort();
98
+ }
99
+ if ((vd + a->stride * (nregs - 1)) > 31) {
100
+ /*
101
+ * Attempts to write off the end of the register file are
102
+ * UNPREDICTABLE; we choose to UNDEF because otherwise we would
103
+ * access off the end of the array that holds the register data.
104
+ */
105
+ return false;
106
+ }
107
+
108
+ if (!vfp_access_check(s)) {
109
+ return true;
110
+ }
111
+
112
+ tmp = tcg_temp_new_i32();
113
+ addr = tcg_temp_new_i32();
114
+ load_reg_var(s, addr, a->rn);
115
+ /*
116
+ * TODO: if we implemented alignment exceptions, we should check
117
+ * addr against the alignment encoded in a->align here.
118
+ */
119
+ for (reg = 0; reg < nregs; reg++) {
120
+ if (a->l) {
121
+ gen_aa32_ld_i32(s, tmp, addr, get_mem_index(s),
122
+ s->be_data | a->size);
123
+ neon_store_element(vd, a->reg_idx, a->size, tmp);
124
+ } else { /* Store */
125
+ neon_load_element(tmp, vd, a->reg_idx, a->size);
126
+ gen_aa32_st_i32(s, tmp, addr, get_mem_index(s),
127
+ s->be_data | a->size);
128
+ }
129
+ vd += a->stride;
130
+ tcg_gen_addi_i32(addr, addr, 1 << a->size);
131
+ }
132
+ tcg_temp_free_i32(addr);
133
+ tcg_temp_free_i32(tmp);
134
+
135
+ gen_neon_ldst_base_update(s, a->rm, a->rn, (1 << a->size) * nregs);
136
+
137
+ return true;
138
+}
139
diff --git a/target/arm/translate.c b/target/arm/translate.c
140
index XXXXXXX..XXXXXXX 100644
141
--- a/target/arm/translate.c
142
+++ b/target/arm/translate.c
143
@@ -XXX,XX +XXX,XX @@ static void gen_neon_trn_u16(TCGv_i32 t0, TCGv_i32 t1)
144
tcg_temp_free_i32(rd);
145
}
146
35
147
-
36
-
148
-/* Translate a NEON load/store element instruction. Return nonzero if the
37
-#if defined(TARGET_ALPHA)
149
- instruction is invalid. */
38
-#define QEMU_ARCH QEMU_ARCH_ALPHA
150
-static int disas_neon_ls_insn(DisasContext *s, uint32_t insn)
39
-#elif defined(TARGET_ARM)
151
-{
40
-#define QEMU_ARCH QEMU_ARCH_ARM
152
- int rd, rn, rm;
41
-#elif defined(TARGET_CRIS)
153
- int nregs;
42
-#define QEMU_ARCH QEMU_ARCH_CRIS
154
- int stride;
43
-#elif defined(TARGET_HPPA)
155
- int size;
44
-#define QEMU_ARCH QEMU_ARCH_HPPA
156
- int reg;
45
-#elif defined(TARGET_I386)
157
- int load;
46
-#define QEMU_ARCH QEMU_ARCH_I386
158
- TCGv_i32 addr;
47
-#elif defined(TARGET_M68K)
159
- TCGv_i32 tmp;
48
-#define QEMU_ARCH QEMU_ARCH_M68K
49
-#elif defined(TARGET_MICROBLAZE)
50
-#define QEMU_ARCH QEMU_ARCH_MICROBLAZE
51
-#elif defined(TARGET_MIPS)
52
-#define QEMU_ARCH QEMU_ARCH_MIPS
53
-#elif defined(TARGET_NIOS2)
54
-#define QEMU_ARCH QEMU_ARCH_NIOS2
55
-#elif defined(TARGET_OPENRISC)
56
-#define QEMU_ARCH QEMU_ARCH_OPENRISC
57
-#elif defined(TARGET_PPC)
58
-#define QEMU_ARCH QEMU_ARCH_PPC
59
-#elif defined(TARGET_RISCV)
60
-#define QEMU_ARCH QEMU_ARCH_RISCV
61
-#elif defined(TARGET_RX)
62
-#define QEMU_ARCH QEMU_ARCH_RX
63
-#elif defined(TARGET_S390X)
64
-#define QEMU_ARCH QEMU_ARCH_S390X
65
-#elif defined(TARGET_SH4)
66
-#define QEMU_ARCH QEMU_ARCH_SH4
67
-#elif defined(TARGET_SPARC)
68
-#define QEMU_ARCH QEMU_ARCH_SPARC
69
-#elif defined(TARGET_TRICORE)
70
-#define QEMU_ARCH QEMU_ARCH_TRICORE
71
-#elif defined(TARGET_XTENSA)
72
-#define QEMU_ARCH QEMU_ARCH_XTENSA
73
-#elif defined(TARGET_AVR)
74
-#define QEMU_ARCH QEMU_ARCH_AVR
75
-#endif
160
-
76
-
161
- if (!arm_dc_feature(s, ARM_FEATURE_NEON)) {
77
const uint32_t arch_type = QEMU_ARCH;
162
- return 1;
163
- }
164
-
165
- /* FIXME: this access check should not take precedence over UNDEF
166
- * for invalid encodings; we will generate incorrect syndrome information
167
- * for attempts to execute invalid vfp/neon encodings with FP disabled.
168
- */
169
- if (s->fp_excp_el) {
170
- gen_exception_insn(s, s->pc_curr, EXCP_UDEF,
171
- syn_simd_access_trap(1, 0xe, false), s->fp_excp_el);
172
- return 0;
173
- }
174
-
175
- if (!s->vfp_enabled)
176
- return 1;
177
- VFP_DREG_D(rd, insn);
178
- rn = (insn >> 16) & 0xf;
179
- rm = insn & 0xf;
180
- load = (insn & (1 << 21)) != 0;
181
- if ((insn & (1 << 23)) == 0) {
182
- /* Load store all elements -- handled already by decodetree */
183
- return 1;
184
- } else {
185
- size = (insn >> 10) & 3;
186
- if (size == 3) {
187
- /* Load single element to all lanes -- handled by decodetree */
188
- return 1;
189
- } else {
190
- /* Single element. */
191
- int idx = (insn >> 4) & 0xf;
192
- int reg_idx;
193
- switch (size) {
194
- case 0:
195
- reg_idx = (insn >> 5) & 7;
196
- stride = 1;
197
- break;
198
- case 1:
199
- reg_idx = (insn >> 6) & 3;
200
- stride = (insn & (1 << 5)) ? 2 : 1;
201
- break;
202
- case 2:
203
- reg_idx = (insn >> 7) & 1;
204
- stride = (insn & (1 << 6)) ? 2 : 1;
205
- break;
206
- default:
207
- abort();
208
- }
209
- nregs = ((insn >> 8) & 3) + 1;
210
- /* Catch the UNDEF cases. This is unavoidably a bit messy. */
211
- switch (nregs) {
212
- case 1:
213
- if (((idx & (1 << size)) != 0) ||
214
- (size == 2 && ((idx & 3) == 1 || (idx & 3) == 2))) {
215
- return 1;
216
- }
217
- break;
218
- case 3:
219
- if ((idx & 1) != 0) {
220
- return 1;
221
- }
222
- /* fall through */
223
- case 2:
224
- if (size == 2 && (idx & 2) != 0) {
225
- return 1;
226
- }
227
- break;
228
- case 4:
229
- if ((size == 2) && ((idx & 3) == 3)) {
230
- return 1;
231
- }
232
- break;
233
- default:
234
- abort();
235
- }
236
- if ((rd + stride * (nregs - 1)) > 31) {
237
- /* Attempts to write off the end of the register file
238
- * are UNPREDICTABLE; we choose to UNDEF because otherwise
239
- * the neon_load_reg() would write off the end of the array.
240
- */
241
- return 1;
242
- }
243
- tmp = tcg_temp_new_i32();
244
- addr = tcg_temp_new_i32();
245
- load_reg_var(s, addr, rn);
246
- for (reg = 0; reg < nregs; reg++) {
247
- if (load) {
248
- gen_aa32_ld_i32(s, tmp, addr, get_mem_index(s),
249
- s->be_data | size);
250
- neon_store_element(rd, reg_idx, size, tmp);
251
- } else { /* Store */
252
- neon_load_element(tmp, rd, reg_idx, size);
253
- gen_aa32_st_i32(s, tmp, addr, get_mem_index(s),
254
- s->be_data | size);
255
- }
256
- rd += stride;
257
- tcg_gen_addi_i32(addr, addr, 1 << size);
258
- }
259
- tcg_temp_free_i32(addr);
260
- tcg_temp_free_i32(tmp);
261
- stride = nregs * (1 << size);
262
- }
263
- }
264
- if (rm != 15) {
265
- TCGv_i32 base;
266
-
267
- base = load_reg(s, rn);
268
- if (rm == 13) {
269
- tcg_gen_addi_i32(base, base, stride);
270
- } else {
271
- TCGv_i32 index;
272
- index = load_reg(s, rm);
273
- tcg_gen_add_i32(base, base, index);
274
- tcg_temp_free_i32(index);
275
- }
276
- store_reg(s, rn, base);
277
- }
278
- return 0;
279
-}
280
-
281
static inline void gen_neon_narrow(int size, TCGv_i32 dest, TCGv_i64 src)
282
{
283
switch (size) {
284
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
285
}
286
return;
287
}
288
- if ((insn & 0x0f100000) == 0x04000000) {
289
- /* NEON load/store. */
290
- if (disas_neon_ls_insn(s, insn)) {
291
- goto illegal_op;
292
- }
293
- return;
294
- }
295
if ((insn & 0x0e000f00) == 0x0c000100) {
296
if (arm_dc_feature(s, ARM_FEATURE_IWMMXT)) {
297
/* iWMMXt register transfer. */
298
@@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn)
299
}
300
break;
301
case 12:
302
- if ((insn & 0x01100000) == 0x01000000) {
303
- if (disas_neon_ls_insn(s, insn)) {
304
- goto illegal_op;
305
- }
306
- break;
307
- }
308
goto illegal_op;
309
default:
310
illegal_op:
311
--
78
--
312
2.20.1
79
2.20.1
313
80
314
81
diff view generated by jsdifflib
1
Convert the V[US]DOT (scalar) insns in the 2reg-scalar-ext group
1
When Hexagon was added we forgot to add it to the QEMU_ARCH_*
2
to decodetree.
2
enumeration. This doesn't cause a visible effect because at the
3
moment Hexagon is linux-user only and the QEMU_ARCH_* constants are
4
only used in softmmu, but we might as well add it in, since it's the
5
only architecture currently missing from the list.
3
6
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20200430181003.21682-10-peter.maydell@linaro.org
10
Reviewed-by: Taylor Simpson <tsimpson@quicinc.com>
11
Message-id: 20210730105947.28215-6-peter.maydell@linaro.org
7
---
12
---
8
target/arm/neon-shared.decode | 3 +++
13
include/sysemu/arch_init.h | 1 +
9
target/arm/translate-neon.inc.c | 35 +++++++++++++++++++++++++++++++++
14
1 file changed, 1 insertion(+)
10
target/arm/translate.c | 13 +-----------
11
3 files changed, 39 insertions(+), 12 deletions(-)
12
15
13
diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode
16
diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h
14
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/neon-shared.decode
18
--- a/include/sysemu/arch_init.h
16
+++ b/target/arm/neon-shared.decode
19
+++ b/include/sysemu/arch_init.h
17
@@ -XXX,XX +XXX,XX @@ VCMLA_scalar 1111 1110 0 . rot:2 .... .... 1000 . q:1 index:1 0 vm:4 \
20
@@ -XXX,XX +XXX,XX @@ enum {
18
vn=%vn_dp vd=%vd_dp size=0
21
QEMU_ARCH_RISCV = (1 << 19),
19
VCMLA_scalar 1111 1110 1 . rot:2 .... .... 1000 . q:1 . 0 .... \
22
QEMU_ARCH_RX = (1 << 20),
20
vm=%vm_dp vn=%vn_dp vd=%vd_dp size=1 index=0
23
QEMU_ARCH_AVR = (1 << 21),
21
+
24
+ QEMU_ARCH_HEXAGON = (1 << 22),
22
+VDOT_scalar 1111 1110 0 . 10 .... .... 1101 . q:1 index:1 u:1 rm:4 \
25
23
+ vm=%vm_dp vn=%vn_dp vd=%vd_dp
26
QEMU_ARCH_NONE = (1 << 31),
24
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
27
};
25
index XXXXXXX..XXXXXXX 100644
26
--- a/target/arm/translate-neon.inc.c
27
+++ b/target/arm/translate-neon.inc.c
28
@@ -XXX,XX +XXX,XX @@ static bool trans_VCMLA_scalar(DisasContext *s, arg_VCMLA_scalar *a)
29
tcg_temp_free_ptr(fpst);
30
return true;
31
}
32
+
33
+static bool trans_VDOT_scalar(DisasContext *s, arg_VDOT_scalar *a)
34
+{
35
+ gen_helper_gvec_3 *fn_gvec;
36
+ int opr_sz;
37
+ TCGv_ptr fpst;
38
+
39
+ if (!dc_isar_feature(aa32_dp, s)) {
40
+ return false;
41
+ }
42
+
43
+ /* UNDEF accesses to D16-D31 if they don't exist. */
44
+ if (!dc_isar_feature(aa32_simd_r32, s) &&
45
+ ((a->vd | a->vn) & 0x10)) {
46
+ return false;
47
+ }
48
+
49
+ if ((a->vd | a->vn) & a->q) {
50
+ return false;
51
+ }
52
+
53
+ if (!vfp_access_check(s)) {
54
+ return true;
55
+ }
56
+
57
+ fn_gvec = a->u ? gen_helper_gvec_udot_idx_b : gen_helper_gvec_sdot_idx_b;
58
+ opr_sz = (1 + a->q) * 8;
59
+ fpst = get_fpstatus_ptr(1);
60
+ tcg_gen_gvec_3_ool(vfp_reg_offset(1, a->vd),
61
+ vfp_reg_offset(1, a->vn),
62
+ vfp_reg_offset(1, a->rm),
63
+ opr_sz, opr_sz, a->index, fn_gvec);
64
+ tcg_temp_free_ptr(fpst);
65
+ return true;
66
+}
67
diff --git a/target/arm/translate.c b/target/arm/translate.c
68
index XXXXXXX..XXXXXXX 100644
69
--- a/target/arm/translate.c
70
+++ b/target/arm/translate.c
71
@@ -XXX,XX +XXX,XX @@ static int disas_neon_insn_2reg_scalar_ext(DisasContext *s, uint32_t insn)
72
bool is_long = false, q = extract32(insn, 6, 1);
73
bool ptr_is_env = false;
74
75
- if ((insn & 0xffb00f00) == 0xfe200d00) {
76
- /* V[US]DOT -- 1111 1110 0.10 .... .... 1101 .Q.U .... */
77
- int u = extract32(insn, 4, 1);
78
-
79
- if (!dc_isar_feature(aa32_dp, s)) {
80
- return 1;
81
- }
82
- fn_gvec = u ? gen_helper_gvec_udot_idx_b : gen_helper_gvec_sdot_idx_b;
83
- /* rm is just Vm, and index is M. */
84
- data = extract32(insn, 5, 1); /* index */
85
- rm = extract32(insn, 0, 4);
86
- } else if ((insn & 0xffa00f10) == 0xfe000810) {
87
+ if ((insn & 0xffa00f10) == 0xfe000810) {
88
/* VFM[AS]L -- 1111 1110 0.0S .... .... 1000 .Q.1 .... */
89
int is_s = extract32(insn, 20, 1);
90
int vm20 = extract32(insn, 0, 3);
91
--
28
--
92
2.20.1
29
2.20.1
93
30
94
31
diff view generated by jsdifflib
1
Convert the V[US]DOT (vector) insns to decodetree.
1
The QEMU_ARCH_VIRTIO_* defines are used only in one file,
2
qdev-monitor.c. Move them to that file.
2
3
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Message-id: 20200430181003.21682-7-peter.maydell@linaro.org
6
Reviewed-by: Markus Armbruster <armbru@redhat.com>
7
Message-id: 20210730105947.28215-7-peter.maydell@linaro.org
6
---
8
---
7
target/arm/neon-shared.decode | 4 ++++
9
include/sysemu/arch_init.h | 9 ---------
8
target/arm/translate-neon.inc.c | 32 ++++++++++++++++++++++++++++++++
10
softmmu/qdev-monitor.c | 9 +++++++++
9
target/arm/translate.c | 9 +--------
11
2 files changed, 9 insertions(+), 9 deletions(-)
10
3 files changed, 37 insertions(+), 8 deletions(-)
11
12
12
diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode
13
diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h
13
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
14
--- a/target/arm/neon-shared.decode
15
--- a/include/sysemu/arch_init.h
15
+++ b/target/arm/neon-shared.decode
16
+++ b/include/sysemu/arch_init.h
16
@@ -XXX,XX +XXX,XX @@ VCMLA 1111 110 rot:2 . 1 size:1 .... .... 1000 . q:1 . 0 .... \
17
@@ -XXX,XX +XXX,XX @@ enum {
17
18
18
VCADD 1111 110 rot:1 1 . 0 size:1 .... .... 1000 . q:1 . 0 .... \
19
extern const uint32_t arch_type;
19
vm=%vm_dp vn=%vn_dp vd=%vd_dp
20
21
-/* default virtio transport per architecture */
22
-#define QEMU_ARCH_VIRTIO_PCI (QEMU_ARCH_ALPHA | QEMU_ARCH_ARM | \
23
- QEMU_ARCH_HPPA | QEMU_ARCH_I386 | \
24
- QEMU_ARCH_MIPS | QEMU_ARCH_PPC | \
25
- QEMU_ARCH_RISCV | QEMU_ARCH_SH4 | \
26
- QEMU_ARCH_SPARC | QEMU_ARCH_XTENSA)
27
-#define QEMU_ARCH_VIRTIO_CCW (QEMU_ARCH_S390X)
28
-#define QEMU_ARCH_VIRTIO_MMIO (QEMU_ARCH_M68K)
29
-
30
#endif
31
diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c
32
index XXXXXXX..XXXXXXX 100644
33
--- a/softmmu/qdev-monitor.c
34
+++ b/softmmu/qdev-monitor.c
35
@@ -XXX,XX +XXX,XX @@ typedef struct QDevAlias
36
uint32_t arch_mask;
37
} QDevAlias;
38
39
+/* default virtio transport per architecture */
40
+#define QEMU_ARCH_VIRTIO_PCI (QEMU_ARCH_ALPHA | QEMU_ARCH_ARM | \
41
+ QEMU_ARCH_HPPA | QEMU_ARCH_I386 | \
42
+ QEMU_ARCH_MIPS | QEMU_ARCH_PPC | \
43
+ QEMU_ARCH_RISCV | QEMU_ARCH_SH4 | \
44
+ QEMU_ARCH_SPARC | QEMU_ARCH_XTENSA)
45
+#define QEMU_ARCH_VIRTIO_CCW (QEMU_ARCH_S390X)
46
+#define QEMU_ARCH_VIRTIO_MMIO (QEMU_ARCH_M68K)
20
+
47
+
21
+# VUDOT and VSDOT
48
/* Please keep this table sorted by typename. */
22
+VDOT 1111 110 00 . 10 .... .... 1101 . q:1 . u:1 .... \
49
static const QDevAlias qdev_alias_table[] = {
23
+ vm=%vm_dp vn=%vn_dp vd=%vd_dp
50
{ "AC97", "ac97" }, /* -soundhw name */
24
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
25
index XXXXXXX..XXXXXXX 100644
26
--- a/target/arm/translate-neon.inc.c
27
+++ b/target/arm/translate-neon.inc.c
28
@@ -XXX,XX +XXX,XX @@ static bool trans_VCADD(DisasContext *s, arg_VCADD *a)
29
tcg_temp_free_ptr(fpst);
30
return true;
31
}
32
+
33
+static bool trans_VDOT(DisasContext *s, arg_VDOT *a)
34
+{
35
+ int opr_sz;
36
+ gen_helper_gvec_3 *fn_gvec;
37
+
38
+ if (!dc_isar_feature(aa32_dp, s)) {
39
+ return false;
40
+ }
41
+
42
+ /* UNDEF accesses to D16-D31 if they don't exist. */
43
+ if (!dc_isar_feature(aa32_simd_r32, s) &&
44
+ ((a->vd | a->vn | a->vm) & 0x10)) {
45
+ return false;
46
+ }
47
+
48
+ if ((a->vn | a->vm | a->vd) & a->q) {
49
+ return false;
50
+ }
51
+
52
+ if (!vfp_access_check(s)) {
53
+ return true;
54
+ }
55
+
56
+ opr_sz = (1 + a->q) * 8;
57
+ fn_gvec = a->u ? gen_helper_gvec_udot_b : gen_helper_gvec_sdot_b;
58
+ tcg_gen_gvec_3_ool(vfp_reg_offset(1, a->vd),
59
+ vfp_reg_offset(1, a->vn),
60
+ vfp_reg_offset(1, a->vm),
61
+ opr_sz, opr_sz, 0, fn_gvec);
62
+ return true;
63
+}
64
diff --git a/target/arm/translate.c b/target/arm/translate.c
65
index XXXXXXX..XXXXXXX 100644
66
--- a/target/arm/translate.c
67
+++ b/target/arm/translate.c
68
@@ -XXX,XX +XXX,XX @@ static int disas_neon_insn_3same_ext(DisasContext *s, uint32_t insn)
69
bool is_long = false, q = extract32(insn, 6, 1);
70
bool ptr_is_env = false;
71
72
- if ((insn & 0xfeb00f00) == 0xfc200d00) {
73
- /* V[US]DOT -- 1111 1100 0.10 .... .... 1101 .Q.U .... */
74
- bool u = extract32(insn, 4, 1);
75
- if (!dc_isar_feature(aa32_dp, s)) {
76
- return 1;
77
- }
78
- fn_gvec = u ? gen_helper_gvec_udot_b : gen_helper_gvec_sdot_b;
79
- } else if ((insn & 0xff300f10) == 0xfc200810) {
80
+ if ((insn & 0xff300f10) == 0xfc200810) {
81
/* VFM[AS]L -- 1111 1100 S.10 .... .... 1000 .Q.1 .... */
82
int is_s = extract32(insn, 23, 1);
83
if (!dc_isar_feature(aa32_fhm, s)) {
84
--
51
--
85
2.20.1
52
2.20.1
86
53
87
54
diff view generated by jsdifflib
1
Convert the VCADD (vector) insns to decodetree.
1
arch_init.h only defines the QEMU_ARCH_* enumeration and the
2
arch_type global. Don't include it in files that don't use those.
2
3
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Message-id: 20200430181003.21682-6-peter.maydell@linaro.org
7
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
8
Message-id: 20210730105947.28215-8-peter.maydell@linaro.org
6
---
9
---
7
target/arm/neon-shared.decode | 3 +++
10
blockdev.c | 1 -
8
target/arm/translate-neon.inc.c | 37 +++++++++++++++++++++++++++++++++
11
hw/i386/pc.c | 1 -
9
target/arm/translate.c | 11 +---------
12
hw/i386/pc_piix.c | 1 -
10
3 files changed, 41 insertions(+), 10 deletions(-)
13
hw/i386/pc_q35.c | 1 -
14
hw/mips/jazz.c | 1 -
15
hw/mips/malta.c | 1 -
16
hw/ppc/prep.c | 1 -
17
hw/riscv/sifive_e.c | 1 -
18
hw/riscv/sifive_u.c | 1 -
19
hw/riscv/spike.c | 1 -
20
hw/riscv/virt.c | 1 -
21
monitor/qmp-cmds.c | 1 -
22
target/ppc/cpu_init.c | 1 -
23
target/s390x/cpu-sysemu.c | 1 -
24
14 files changed, 14 deletions(-)
11
25
12
diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode
26
diff --git a/blockdev.c b/blockdev.c
13
index XXXXXXX..XXXXXXX 100644
27
index XXXXXXX..XXXXXXX 100644
14
--- a/target/arm/neon-shared.decode
28
--- a/blockdev.c
15
+++ b/target/arm/neon-shared.decode
29
+++ b/blockdev.c
16
@@ -XXX,XX +XXX,XX @@
30
@@ -XXX,XX +XXX,XX @@
17
31
#include "sysemu/iothread.h"
18
VCMLA 1111 110 rot:2 . 1 size:1 .... .... 1000 . q:1 . 0 .... \
32
#include "block/block_int.h"
19
vm=%vm_dp vn=%vn_dp vd=%vd_dp
33
#include "block/trace.h"
20
+
34
-#include "sysemu/arch_init.h"
21
+VCADD 1111 110 rot:1 1 . 0 size:1 .... .... 1000 . q:1 . 0 .... \
35
#include "sysemu/runstate.h"
22
+ vm=%vm_dp vn=%vn_dp vd=%vd_dp
36
#include "sysemu/replay.h"
23
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
37
#include "qemu/cutils.h"
38
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
24
index XXXXXXX..XXXXXXX 100644
39
index XXXXXXX..XXXXXXX 100644
25
--- a/target/arm/translate-neon.inc.c
40
--- a/hw/i386/pc.c
26
+++ b/target/arm/translate-neon.inc.c
41
+++ b/hw/i386/pc.c
27
@@ -XXX,XX +XXX,XX @@ static bool trans_VCMLA(DisasContext *s, arg_VCMLA *a)
42
@@ -XXX,XX +XXX,XX @@
28
tcg_temp_free_ptr(fpst);
43
#include "hw/xen/start_info.h"
29
return true;
44
#include "ui/qemu-spice.h"
30
}
45
#include "exec/memory.h"
31
+
46
-#include "sysemu/arch_init.h"
32
+static bool trans_VCADD(DisasContext *s, arg_VCADD *a)
47
#include "qemu/bitmap.h"
33
+{
48
#include "qemu/config-file.h"
34
+ int opr_sz;
49
#include "qemu/error-report.h"
35
+ TCGv_ptr fpst;
50
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
36
+ gen_helper_gvec_3_ptr *fn_gvec_ptr;
37
+
38
+ if (!dc_isar_feature(aa32_vcma, s)
39
+ || (!a->size && !dc_isar_feature(aa32_fp16_arith, s))) {
40
+ return false;
41
+ }
42
+
43
+ /* UNDEF accesses to D16-D31 if they don't exist. */
44
+ if (!dc_isar_feature(aa32_simd_r32, s) &&
45
+ ((a->vd | a->vn | a->vm) & 0x10)) {
46
+ return false;
47
+ }
48
+
49
+ if ((a->vn | a->vm | a->vd) & a->q) {
50
+ return false;
51
+ }
52
+
53
+ if (!vfp_access_check(s)) {
54
+ return true;
55
+ }
56
+
57
+ opr_sz = (1 + a->q) * 8;
58
+ fpst = get_fpstatus_ptr(1);
59
+ fn_gvec_ptr = a->size ? gen_helper_gvec_fcadds : gen_helper_gvec_fcaddh;
60
+ tcg_gen_gvec_3_ptr(vfp_reg_offset(1, a->vd),
61
+ vfp_reg_offset(1, a->vn),
62
+ vfp_reg_offset(1, a->vm),
63
+ fpst, opr_sz, opr_sz, a->rot,
64
+ fn_gvec_ptr);
65
+ tcg_temp_free_ptr(fpst);
66
+ return true;
67
+}
68
diff --git a/target/arm/translate.c b/target/arm/translate.c
69
index XXXXXXX..XXXXXXX 100644
51
index XXXXXXX..XXXXXXX 100644
70
--- a/target/arm/translate.c
52
--- a/hw/i386/pc_piix.c
71
+++ b/target/arm/translate.c
53
+++ b/hw/i386/pc_piix.c
72
@@ -XXX,XX +XXX,XX @@ static int disas_neon_insn_3same_ext(DisasContext *s, uint32_t insn)
54
@@ -XXX,XX +XXX,XX @@
73
bool is_long = false, q = extract32(insn, 6, 1);
55
#include "sysemu/kvm.h"
74
bool ptr_is_env = false;
56
#include "hw/kvm/clock.h"
75
57
#include "hw/sysbus.h"
76
- if ((insn & 0xfea00f10) == 0xfc800800) {
58
-#include "sysemu/arch_init.h"
77
- /* VCADD -- 1111 110R 1.0S .... .... 1000 ...0 .... */
59
#include "hw/i2c/smbus_eeprom.h"
78
- int size = extract32(insn, 20, 1);
60
#include "hw/xen/xen-x86.h"
79
- data = extract32(insn, 24, 1); /* rot */
61
#include "exec/memory.h"
80
- if (!dc_isar_feature(aa32_vcma, s)
62
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
81
- || (!size && !dc_isar_feature(aa32_fp16_arith, s))) {
63
index XXXXXXX..XXXXXXX 100644
82
- return 1;
64
--- a/hw/i386/pc_q35.c
83
- }
65
+++ b/hw/i386/pc_q35.c
84
- fn_gvec_ptr = size ? gen_helper_gvec_fcadds : gen_helper_gvec_fcaddh;
66
@@ -XXX,XX +XXX,XX @@
85
- } else if ((insn & 0xfeb00f00) == 0xfc200d00) {
67
#include "qemu/osdep.h"
86
+ if ((insn & 0xfeb00f00) == 0xfc200d00) {
68
#include "qemu/units.h"
87
/* V[US]DOT -- 1111 1100 0.10 .... .... 1101 .Q.U .... */
69
#include "hw/loader.h"
88
bool u = extract32(insn, 4, 1);
70
-#include "sysemu/arch_init.h"
89
if (!dc_isar_feature(aa32_dp, s)) {
71
#include "hw/i2c/smbus_eeprom.h"
72
#include "hw/rtc/mc146818rtc.h"
73
#include "sysemu/kvm.h"
74
diff --git a/hw/mips/jazz.c b/hw/mips/jazz.c
75
index XXXXXXX..XXXXXXX 100644
76
--- a/hw/mips/jazz.c
77
+++ b/hw/mips/jazz.c
78
@@ -XXX,XX +XXX,XX @@
79
#include "hw/isa/isa.h"
80
#include "hw/block/fdc.h"
81
#include "sysemu/sysemu.h"
82
-#include "sysemu/arch_init.h"
83
#include "hw/boards.h"
84
#include "net/net.h"
85
#include "hw/scsi/esp.h"
86
diff --git a/hw/mips/malta.c b/hw/mips/malta.c
87
index XXXXXXX..XXXXXXX 100644
88
--- a/hw/mips/malta.c
89
+++ b/hw/mips/malta.c
90
@@ -XXX,XX +XXX,XX @@
91
#include "hw/mips/mips.h"
92
#include "hw/mips/cpudevs.h"
93
#include "hw/pci/pci.h"
94
-#include "sysemu/arch_init.h"
95
#include "qemu/log.h"
96
#include "hw/mips/bios.h"
97
#include "hw/ide.h"
98
diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
99
index XXXXXXX..XXXXXXX 100644
100
--- a/hw/ppc/prep.c
101
+++ b/hw/ppc/prep.c
102
@@ -XXX,XX +XXX,XX @@
103
#include "hw/rtc/mc146818rtc.h"
104
#include "hw/isa/pc87312.h"
105
#include "hw/qdev-properties.h"
106
-#include "sysemu/arch_init.h"
107
#include "sysemu/kvm.h"
108
#include "sysemu/reset.h"
109
#include "trace.h"
110
diff --git a/hw/riscv/sifive_e.c b/hw/riscv/sifive_e.c
111
index XXXXXXX..XXXXXXX 100644
112
--- a/hw/riscv/sifive_e.c
113
+++ b/hw/riscv/sifive_e.c
114
@@ -XXX,XX +XXX,XX @@
115
#include "hw/intc/sifive_plic.h"
116
#include "hw/misc/sifive_e_prci.h"
117
#include "chardev/char.h"
118
-#include "sysemu/arch_init.h"
119
#include "sysemu/sysemu.h"
120
121
static const MemMapEntry sifive_e_memmap[] = {
122
diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c
123
index XXXXXXX..XXXXXXX 100644
124
--- a/hw/riscv/sifive_u.c
125
+++ b/hw/riscv/sifive_u.c
126
@@ -XXX,XX +XXX,XX @@
127
#include "hw/intc/sifive_plic.h"
128
#include "chardev/char.h"
129
#include "net/eth.h"
130
-#include "sysemu/arch_init.h"
131
#include "sysemu/device_tree.h"
132
#include "sysemu/runstate.h"
133
#include "sysemu/sysemu.h"
134
diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c
135
index XXXXXXX..XXXXXXX 100644
136
--- a/hw/riscv/spike.c
137
+++ b/hw/riscv/spike.c
138
@@ -XXX,XX +XXX,XX @@
139
#include "hw/char/riscv_htif.h"
140
#include "hw/intc/sifive_clint.h"
141
#include "chardev/char.h"
142
-#include "sysemu/arch_init.h"
143
#include "sysemu/device_tree.h"
144
#include "sysemu/sysemu.h"
145
146
diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
147
index XXXXXXX..XXXXXXX 100644
148
--- a/hw/riscv/virt.c
149
+++ b/hw/riscv/virt.c
150
@@ -XXX,XX +XXX,XX @@
151
#include "hw/intc/sifive_plic.h"
152
#include "hw/misc/sifive_test.h"
153
#include "chardev/char.h"
154
-#include "sysemu/arch_init.h"
155
#include "sysemu/device_tree.h"
156
#include "sysemu/sysemu.h"
157
#include "hw/pci/pci.h"
158
diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c
159
index XXXXXXX..XXXXXXX 100644
160
--- a/monitor/qmp-cmds.c
161
+++ b/monitor/qmp-cmds.c
162
@@ -XXX,XX +XXX,XX @@
163
#include "sysemu/kvm.h"
164
#include "sysemu/runstate.h"
165
#include "sysemu/runstate-action.h"
166
-#include "sysemu/arch_init.h"
167
#include "sysemu/blockdev.h"
168
#include "sysemu/block-backend.h"
169
#include "qapi/error.h"
170
diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
171
index XXXXXXX..XXXXXXX 100644
172
--- a/target/ppc/cpu_init.c
173
+++ b/target/ppc/cpu_init.c
174
@@ -XXX,XX +XXX,XX @@
175
#include "disas/dis-asm.h"
176
#include "exec/gdbstub.h"
177
#include "kvm_ppc.h"
178
-#include "sysemu/arch_init.h"
179
#include "sysemu/cpus.h"
180
#include "sysemu/hw_accel.h"
181
#include "sysemu/tcg.h"
182
diff --git a/target/s390x/cpu-sysemu.c b/target/s390x/cpu-sysemu.c
183
index XXXXXXX..XXXXXXX 100644
184
--- a/target/s390x/cpu-sysemu.c
185
+++ b/target/s390x/cpu-sysemu.c
186
@@ -XXX,XX +XXX,XX @@
187
188
#include "hw/s390x/pv.h"
189
#include "hw/boards.h"
190
-#include "sysemu/arch_init.h"
191
#include "sysemu/sysemu.h"
192
#include "sysemu/tcg.h"
193
#include "hw/core/sysemu-cpu-ops.h"
90
--
194
--
91
2.20.1
195
2.20.1
92
196
93
197
diff view generated by jsdifflib
1
Convert the VCMLA (vector) insns in the 3same extension group to
1
We added a stub for the arch_type global in commit 5964ed56d9a1 so
2
decodetree.
2
that we could compile blockdev.c into the tools. However, in commit
3
9db1d3a2be9bf we removed the only use of arch_type from blockdev.c.
4
The stub is therefore no longer needed, and we can delete it again,
5
together with the QEMU_ARCH_NONE value that only the stub was using.
3
6
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20200430181003.21682-5-peter.maydell@linaro.org
10
Message-id: 20210730105947.28215-9-peter.maydell@linaro.org
7
---
11
---
8
target/arm/neon-shared.decode | 11 ++++++++++
12
include/sysemu/arch_init.h | 2 --
9
target/arm/translate-neon.inc.c | 37 +++++++++++++++++++++++++++++++++
13
stubs/arch_type.c | 4 ----
10
target/arm/translate.c | 11 +---------
14
stubs/meson.build | 1 -
11
3 files changed, 49 insertions(+), 10 deletions(-)
15
3 files changed, 7 deletions(-)
16
delete mode 100644 stubs/arch_type.c
12
17
13
diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode
18
diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h
14
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/neon-shared.decode
20
--- a/include/sysemu/arch_init.h
16
+++ b/target/arm/neon-shared.decode
21
+++ b/include/sysemu/arch_init.h
22
@@ -XXX,XX +XXX,XX @@ enum {
23
QEMU_ARCH_RX = (1 << 20),
24
QEMU_ARCH_AVR = (1 << 21),
25
QEMU_ARCH_HEXAGON = (1 << 22),
26
-
27
- QEMU_ARCH_NONE = (1 << 31),
28
};
29
30
extern const uint32_t arch_type;
31
diff --git a/stubs/arch_type.c b/stubs/arch_type.c
32
deleted file mode 100644
33
index XXXXXXX..XXXXXXX
34
--- a/stubs/arch_type.c
35
+++ /dev/null
17
@@ -XXX,XX +XXX,XX @@
36
@@ -XXX,XX +XXX,XX @@
18
# More specifically, this covers:
37
-#include "qemu/osdep.h"
19
# 2reg scalar ext: 0b1111_1110_xxxx_xxxx_xxxx_1x0x_xxxx_xxxx
38
-#include "sysemu/arch_init.h"
20
# 3same ext: 0b1111_110x_xxxx_xxxx_xxxx_1x0x_xxxx_xxxx
39
-
21
+
40
-const uint32_t arch_type = QEMU_ARCH_NONE;
22
+# VFP/Neon register fields; same as vfp.decode
41
diff --git a/stubs/meson.build b/stubs/meson.build
23
+%vm_dp 5:1 0:4
24
+%vm_sp 0:4 5:1
25
+%vn_dp 7:1 16:4
26
+%vn_sp 16:4 7:1
27
+%vd_dp 22:1 12:4
28
+%vd_sp 12:4 22:1
29
+
30
+VCMLA 1111 110 rot:2 . 1 size:1 .... .... 1000 . q:1 . 0 .... \
31
+ vm=%vm_dp vn=%vn_dp vd=%vd_dp
32
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
33
index XXXXXXX..XXXXXXX 100644
42
index XXXXXXX..XXXXXXX 100644
34
--- a/target/arm/translate-neon.inc.c
43
--- a/stubs/meson.build
35
+++ b/target/arm/translate-neon.inc.c
44
+++ b/stubs/meson.build
36
@@ -XXX,XX +XXX,XX @@
45
@@ -XXX,XX +XXX,XX @@
37
#include "decode-neon-dp.inc.c"
46
-stub_ss.add(files('arch_type.c'))
38
#include "decode-neon-ls.inc.c"
47
stub_ss.add(files('bdrv-next-monitor-owned.c'))
39
#include "decode-neon-shared.inc.c"
48
stub_ss.add(files('blk-commit-all.c'))
40
+
49
stub_ss.add(files('blk-exp-close-all.c'))
41
+static bool trans_VCMLA(DisasContext *s, arg_VCMLA *a)
42
+{
43
+ int opr_sz;
44
+ TCGv_ptr fpst;
45
+ gen_helper_gvec_3_ptr *fn_gvec_ptr;
46
+
47
+ if (!dc_isar_feature(aa32_vcma, s)
48
+ || (!a->size && !dc_isar_feature(aa32_fp16_arith, s))) {
49
+ return false;
50
+ }
51
+
52
+ /* UNDEF accesses to D16-D31 if they don't exist. */
53
+ if (!dc_isar_feature(aa32_simd_r32, s) &&
54
+ ((a->vd | a->vn | a->vm) & 0x10)) {
55
+ return false;
56
+ }
57
+
58
+ if ((a->vn | a->vm | a->vd) & a->q) {
59
+ return false;
60
+ }
61
+
62
+ if (!vfp_access_check(s)) {
63
+ return true;
64
+ }
65
+
66
+ opr_sz = (1 + a->q) * 8;
67
+ fpst = get_fpstatus_ptr(1);
68
+ fn_gvec_ptr = a->size ? gen_helper_gvec_fcmlas : gen_helper_gvec_fcmlah;
69
+ tcg_gen_gvec_3_ptr(vfp_reg_offset(1, a->vd),
70
+ vfp_reg_offset(1, a->vn),
71
+ vfp_reg_offset(1, a->vm),
72
+ fpst, opr_sz, opr_sz, a->rot,
73
+ fn_gvec_ptr);
74
+ tcg_temp_free_ptr(fpst);
75
+ return true;
76
+}
77
diff --git a/target/arm/translate.c b/target/arm/translate.c
78
index XXXXXXX..XXXXXXX 100644
79
--- a/target/arm/translate.c
80
+++ b/target/arm/translate.c
81
@@ -XXX,XX +XXX,XX @@ static int disas_neon_insn_3same_ext(DisasContext *s, uint32_t insn)
82
bool is_long = false, q = extract32(insn, 6, 1);
83
bool ptr_is_env = false;
84
85
- if ((insn & 0xfe200f10) == 0xfc200800) {
86
- /* VCMLA -- 1111 110R R.1S .... .... 1000 ...0 .... */
87
- int size = extract32(insn, 20, 1);
88
- data = extract32(insn, 23, 2); /* rot */
89
- if (!dc_isar_feature(aa32_vcma, s)
90
- || (!size && !dc_isar_feature(aa32_fp16_arith, s))) {
91
- return 1;
92
- }
93
- fn_gvec_ptr = size ? gen_helper_gvec_fcmlas : gen_helper_gvec_fcmlah;
94
- } else if ((insn & 0xfea00f10) == 0xfc800800) {
95
+ if ((insn & 0xfea00f10) == 0xfc800800) {
96
/* VCADD -- 1111 110R 1.0S .... .... 1000 ...0 .... */
97
int size = extract32(insn, 20, 1);
98
data = extract32(insn, 24, 1); /* rot */
99
--
50
--
100
2.20.1
51
2.20.1
101
52
102
53
diff view generated by jsdifflib
1
Convert the Neon "load/store multiple structures" insns to decodetree.
1
The gunzip() function reads various fields from a passed in source
2
buffer in order to skip a header before passing the actual compressed
3
data to the zlib inflate() function. It does check whether the
4
passed in buffer is too small, but unfortunately it checks that only
5
after reading bytes from the src buffer, so it could read off the end
6
of the buffer.
2
7
8
You can see this with valgrind:
9
10
$ printf "%b" '\x1f\x8b' > /tmp/image
11
$ valgrind qemu-system-aarch64 -display none -M virt -cpu max -kernel /tmp/image
12
[...]
13
==19224== Invalid read of size 1
14
==19224== at 0x67302E: gunzip (loader.c:558)
15
==19224== by 0x673907: load_image_gzipped_buffer (loader.c:788)
16
==19224== by 0xA18032: load_aarch64_image (boot.c:932)
17
==19224== by 0xA18489: arm_setup_direct_kernel_boot (boot.c:1063)
18
==19224== by 0xA18D90: arm_load_kernel (boot.c:1317)
19
==19224== by 0x9F3651: machvirt_init (virt.c:2114)
20
==19224== by 0x794B7A: machine_run_board_init (machine.c:1272)
21
==19224== by 0xD5CAD3: qemu_init_board (vl.c:2618)
22
==19224== by 0xD5CCA6: qmp_x_exit_preconfig (vl.c:2692)
23
==19224== by 0xD5F32E: qemu_init (vl.c:3713)
24
==19224== by 0x5ADDB1: main (main.c:49)
25
==19224== Address 0x3802a873 is 0 bytes after a block of size 3 alloc'd
26
==19224== at 0x4C31B0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
27
==19224== by 0x61E7657: g_file_get_contents (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.5600.4)
28
==19224== by 0x673895: load_image_gzipped_buffer (loader.c:771)
29
==19224== by 0xA18032: load_aarch64_image (boot.c:932)
30
==19224== by 0xA18489: arm_setup_direct_kernel_boot (boot.c:1063)
31
==19224== by 0xA18D90: arm_load_kernel (boot.c:1317)
32
==19224== by 0x9F3651: machvirt_init (virt.c:2114)
33
==19224== by 0x794B7A: machine_run_board_init (machine.c:1272)
34
==19224== by 0xD5CAD3: qemu_init_board (vl.c:2618)
35
==19224== by 0xD5CCA6: qmp_x_exit_preconfig (vl.c:2692)
36
==19224== by 0xD5F32E: qemu_init (vl.c:3713)
37
==19224== by 0x5ADDB1: main (main.c:49)
38
39
Check that we have enough bytes of data to read the header bytes that
40
we read before we read them.
41
42
Fixes: Coverity 1458997
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
43
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
44
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
5
Message-id: 20200430181003.21682-12-peter.maydell@linaro.org
45
Message-id: 20210812141803.20913-1-peter.maydell@linaro.org
6
---
46
---
7
target/arm/neon-ls.decode | 7 ++
47
hw/core/loader.c | 35 +++++++++++++++++++++++++----------
8
target/arm/translate-neon.inc.c | 124 ++++++++++++++++++++++++++++++++
48
1 file changed, 25 insertions(+), 10 deletions(-)
9
target/arm/translate.c | 91 +----------------------
10
3 files changed, 133 insertions(+), 89 deletions(-)
11
49
12
diff --git a/target/arm/neon-ls.decode b/target/arm/neon-ls.decode
50
diff --git a/hw/core/loader.c b/hw/core/loader.c
13
index XXXXXXX..XXXXXXX 100644
51
index XXXXXXX..XXXXXXX 100644
14
--- a/target/arm/neon-ls.decode
52
--- a/hw/core/loader.c
15
+++ b/target/arm/neon-ls.decode
53
+++ b/hw/core/loader.c
16
@@ -XXX,XX +XXX,XX @@
54
@@ -XXX,XX +XXX,XX @@ ssize_t gunzip(void *dst, size_t dstlen, uint8_t *src, size_t srclen)
17
# 0b1111_1001_xxx0_xxxx_xxxx_xxxx_xxxx_xxxx
55
18
# This file works on the A32 encoding only; calling code for T32 has to
56
/* skip header */
19
# transform the insn into the A32 version first.
57
i = 10;
20
+
58
+ if (srclen < 4) {
21
+%vd_dp 22:1 12:4
59
+ goto toosmall;
22
+
60
+ }
23
+# Neon load/store multiple structures
61
flags = src[3];
24
+
62
if (src[2] != DEFLATED || (flags & RESERVED) != 0) {
25
+VLDST_multiple 1111 0100 0 . l:1 0 rn:4 .... itype:4 size:2 align:2 rm:4 \
63
puts ("Error: Bad gzipped data\n");
26
+ vd=%vd_dp
64
return -1;
27
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
65
}
28
index XXXXXXX..XXXXXXX 100644
66
- if ((flags & EXTRA_FIELD) != 0)
29
--- a/target/arm/translate-neon.inc.c
67
+ if ((flags & EXTRA_FIELD) != 0) {
30
+++ b/target/arm/translate-neon.inc.c
68
+ if (srclen < 12) {
31
@@ -XXX,XX +XXX,XX @@ static bool trans_VFML_scalar(DisasContext *s, arg_VFML_scalar *a)
69
+ goto toosmall;
32
gen_helper_gvec_fmlal_idx_a32);
33
return true;
34
}
35
+
36
+static struct {
37
+ int nregs;
38
+ int interleave;
39
+ int spacing;
40
+} const neon_ls_element_type[11] = {
41
+ {1, 4, 1},
42
+ {1, 4, 2},
43
+ {4, 1, 1},
44
+ {2, 2, 2},
45
+ {1, 3, 1},
46
+ {1, 3, 2},
47
+ {3, 1, 1},
48
+ {1, 1, 1},
49
+ {1, 2, 1},
50
+ {1, 2, 2},
51
+ {2, 1, 1}
52
+};
53
+
54
+static void gen_neon_ldst_base_update(DisasContext *s, int rm, int rn,
55
+ int stride)
56
+{
57
+ if (rm != 15) {
58
+ TCGv_i32 base;
59
+
60
+ base = load_reg(s, rn);
61
+ if (rm == 13) {
62
+ tcg_gen_addi_i32(base, base, stride);
63
+ } else {
64
+ TCGv_i32 index;
65
+ index = load_reg(s, rm);
66
+ tcg_gen_add_i32(base, base, index);
67
+ tcg_temp_free_i32(index);
68
+ }
70
+ }
69
+ store_reg(s, rn, base);
71
i = 12 + src[10] + (src[11] << 8);
72
- if ((flags & ORIG_NAME) != 0)
73
- while (src[i++] != 0)
74
- ;
75
- if ((flags & COMMENT) != 0)
76
- while (src[i++] != 0)
77
- ;
78
- if ((flags & HEAD_CRC) != 0)
70
+ }
79
+ }
71
+}
80
+ if ((flags & ORIG_NAME) != 0) {
72
+
81
+ while (i < srclen && src[i++] != 0) {
73
+static bool trans_VLDST_multiple(DisasContext *s, arg_VLDST_multiple *a)
82
+ /* do nothing */
74
+{
75
+ /* Neon load/store multiple structures */
76
+ int nregs, interleave, spacing, reg, n;
77
+ MemOp endian = s->be_data;
78
+ int mmu_idx = get_mem_index(s);
79
+ int size = a->size;
80
+ TCGv_i64 tmp64;
81
+ TCGv_i32 addr, tmp;
82
+
83
+ if (!arm_dc_feature(s, ARM_FEATURE_NEON)) {
84
+ return false;
85
+ }
86
+
87
+ /* UNDEF accesses to D16-D31 if they don't exist */
88
+ if (!dc_isar_feature(aa32_simd_r32, s) && (a->vd & 0x10)) {
89
+ return false;
90
+ }
91
+ if (a->itype > 10) {
92
+ return false;
93
+ }
94
+ /* Catch UNDEF cases for bad values of align field */
95
+ switch (a->itype & 0xc) {
96
+ case 4:
97
+ if (a->align >= 2) {
98
+ return false;
99
+ }
100
+ break;
101
+ case 8:
102
+ if (a->align == 3) {
103
+ return false;
104
+ }
105
+ break;
106
+ default:
107
+ break;
108
+ }
109
+ nregs = neon_ls_element_type[a->itype].nregs;
110
+ interleave = neon_ls_element_type[a->itype].interleave;
111
+ spacing = neon_ls_element_type[a->itype].spacing;
112
+ if (size == 3 && (interleave | spacing) != 1) {
113
+ return false;
114
+ }
115
+
116
+ if (!vfp_access_check(s)) {
117
+ return true;
118
+ }
119
+
120
+ /* For our purposes, bytes are always little-endian. */
121
+ if (size == 0) {
122
+ endian = MO_LE;
123
+ }
124
+ /*
125
+ * Consecutive little-endian elements from a single register
126
+ * can be promoted to a larger little-endian operation.
127
+ */
128
+ if (interleave == 1 && endian == MO_LE) {
129
+ size = 3;
130
+ }
131
+ tmp64 = tcg_temp_new_i64();
132
+ addr = tcg_temp_new_i32();
133
+ tmp = tcg_const_i32(1 << size);
134
+ load_reg_var(s, addr, a->rn);
135
+ for (reg = 0; reg < nregs; reg++) {
136
+ for (n = 0; n < 8 >> size; n++) {
137
+ int xs;
138
+ for (xs = 0; xs < interleave; xs++) {
139
+ int tt = a->vd + reg + spacing * xs;
140
+
141
+ if (a->l) {
142
+ gen_aa32_ld_i64(s, tmp64, addr, mmu_idx, endian | size);
143
+ neon_store_element64(tt, n, size, tmp64);
144
+ } else {
145
+ neon_load_element64(tmp64, tt, n, size);
146
+ gen_aa32_st_i64(s, tmp64, addr, mmu_idx, endian | size);
147
+ }
148
+ tcg_gen_add_i32(addr, addr, tmp);
149
+ }
150
+ }
83
+ }
151
+ }
84
+ }
152
+ tcg_temp_free_i32(addr);
85
+ if ((flags & COMMENT) != 0) {
153
+ tcg_temp_free_i32(tmp);
86
+ while (i < srclen && src[i++] != 0) {
154
+ tcg_temp_free_i64(tmp64);
87
+ /* do nothing */
88
+ }
89
+ }
90
+ if ((flags & HEAD_CRC) != 0) {
91
i += 2;
92
+ }
93
if (i >= srclen) {
94
- puts ("Error: gunzip out of data in header\n");
95
- return -1;
96
+ goto toosmall;
97
}
98
99
s.zalloc = zalloc;
100
@@ -XXX,XX +XXX,XX @@ ssize_t gunzip(void *dst, size_t dstlen, uint8_t *src, size_t srclen)
101
inflateEnd(&s);
102
103
return dstbytes;
155
+
104
+
156
+ gen_neon_ldst_base_update(s, a->rm, a->rn, nregs * interleave * 8);
105
+toosmall:
157
+ return true;
106
+ puts("Error: gunzip out of data in header\n");
158
+}
107
+ return -1;
159
diff --git a/target/arm/translate.c b/target/arm/translate.c
160
index XXXXXXX..XXXXXXX 100644
161
--- a/target/arm/translate.c
162
+++ b/target/arm/translate.c
163
@@ -XXX,XX +XXX,XX @@ static void gen_neon_trn_u16(TCGv_i32 t0, TCGv_i32 t1)
164
}
108
}
165
109
166
110
/* Load a U-Boot image. */
167
-static struct {
168
- int nregs;
169
- int interleave;
170
- int spacing;
171
-} const neon_ls_element_type[11] = {
172
- {1, 4, 1},
173
- {1, 4, 2},
174
- {4, 1, 1},
175
- {2, 2, 2},
176
- {1, 3, 1},
177
- {1, 3, 2},
178
- {3, 1, 1},
179
- {1, 1, 1},
180
- {1, 2, 1},
181
- {1, 2, 2},
182
- {2, 1, 1}
183
-};
184
-
185
/* Translate a NEON load/store element instruction. Return nonzero if the
186
instruction is invalid. */
187
static int disas_neon_ls_insn(DisasContext *s, uint32_t insn)
188
{
189
int rd, rn, rm;
190
- int op;
191
int nregs;
192
- int interleave;
193
- int spacing;
194
int stride;
195
int size;
196
int reg;
197
int load;
198
- int n;
199
int vec_size;
200
- int mmu_idx;
201
- MemOp endian;
202
TCGv_i32 addr;
203
TCGv_i32 tmp;
204
- TCGv_i32 tmp2;
205
- TCGv_i64 tmp64;
206
207
if (!arm_dc_feature(s, ARM_FEATURE_NEON)) {
208
return 1;
209
@@ -XXX,XX +XXX,XX @@ static int disas_neon_ls_insn(DisasContext *s, uint32_t insn)
210
rn = (insn >> 16) & 0xf;
211
rm = insn & 0xf;
212
load = (insn & (1 << 21)) != 0;
213
- endian = s->be_data;
214
- mmu_idx = get_mem_index(s);
215
if ((insn & (1 << 23)) == 0) {
216
- /* Load store all elements. */
217
- op = (insn >> 8) & 0xf;
218
- size = (insn >> 6) & 3;
219
- if (op > 10)
220
- return 1;
221
- /* Catch UNDEF cases for bad values of align field */
222
- switch (op & 0xc) {
223
- case 4:
224
- if (((insn >> 5) & 1) == 1) {
225
- return 1;
226
- }
227
- break;
228
- case 8:
229
- if (((insn >> 4) & 3) == 3) {
230
- return 1;
231
- }
232
- break;
233
- default:
234
- break;
235
- }
236
- nregs = neon_ls_element_type[op].nregs;
237
- interleave = neon_ls_element_type[op].interleave;
238
- spacing = neon_ls_element_type[op].spacing;
239
- if (size == 3 && (interleave | spacing) != 1) {
240
- return 1;
241
- }
242
- /* For our purposes, bytes are always little-endian. */
243
- if (size == 0) {
244
- endian = MO_LE;
245
- }
246
- /* Consecutive little-endian elements from a single register
247
- * can be promoted to a larger little-endian operation.
248
- */
249
- if (interleave == 1 && endian == MO_LE) {
250
- size = 3;
251
- }
252
- tmp64 = tcg_temp_new_i64();
253
- addr = tcg_temp_new_i32();
254
- tmp2 = tcg_const_i32(1 << size);
255
- load_reg_var(s, addr, rn);
256
- for (reg = 0; reg < nregs; reg++) {
257
- for (n = 0; n < 8 >> size; n++) {
258
- int xs;
259
- for (xs = 0; xs < interleave; xs++) {
260
- int tt = rd + reg + spacing * xs;
261
-
262
- if (load) {
263
- gen_aa32_ld_i64(s, tmp64, addr, mmu_idx, endian | size);
264
- neon_store_element64(tt, n, size, tmp64);
265
- } else {
266
- neon_load_element64(tmp64, tt, n, size);
267
- gen_aa32_st_i64(s, tmp64, addr, mmu_idx, endian | size);
268
- }
269
- tcg_gen_add_i32(addr, addr, tmp2);
270
- }
271
- }
272
- }
273
- tcg_temp_free_i32(addr);
274
- tcg_temp_free_i32(tmp2);
275
- tcg_temp_free_i64(tmp64);
276
- stride = nregs * interleave * 8;
277
+ /* Load store all elements -- handled already by decodetree */
278
+ return 1;
279
} else {
280
size = (insn >> 10) & 3;
281
if (size == 3) {
282
--
111
--
283
2.20.1
112
2.20.1
284
113
285
114
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
In the alignment check added to qemu_ram_alloc_from_fd() in commit
2
ce317be98db0dfdfa, the condition includes a check that 'mr' is not
3
NULL. This check is unnecessary because we can assume that the
4
caller always passes us a valid MemoryRegion, and indeed later in the
5
function we assume mr is not NULL when we pass it to file_ram_alloc()
6
as new_block->mr. Remove it.
2
7
3
By using the TYPE_* definitions for devices, we can:
8
Fixes: Coverity 1459867
4
- quickly find where devices are used with 'git-grep'
9
Fixes: ce317be98d ("exec: fetch the alignment of Linux devdax pmem character device nodes")
5
- easily rename a device (one-line change).
6
7
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
Message-id: 20200428154650.21991-1-f4bug@amsat.org
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Jingqi Liu <jingqi.liu@intel.com>
12
Message-id: 20210812150624.29139-1-peter.maydell@linaro.org
11
---
13
---
12
hw/arm/mps2-tz.c | 2 +-
14
softmmu/physmem.c | 2 +-
13
1 file changed, 1 insertion(+), 1 deletion(-)
15
1 file changed, 1 insertion(+), 1 deletion(-)
14
16
15
diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c
17
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
16
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/arm/mps2-tz.c
19
--- a/softmmu/physmem.c
18
+++ b/hw/arm/mps2-tz.c
20
+++ b/softmmu/physmem.c
19
@@ -XXX,XX +XXX,XX @@ static void mps2tz_common_init(MachineState *machine)
21
@@ -XXX,XX +XXX,XX @@ RAMBlock *qemu_ram_alloc_from_fd(ram_addr_t size, MemoryRegion *mr,
20
exit(EXIT_FAILURE);
21
}
22
}
22
23
23
- sysbus_init_child_obj(OBJECT(machine), "iotkit", &mms->iotkit,
24
file_align = get_file_align(fd);
24
+ sysbus_init_child_obj(OBJECT(machine), TYPE_IOTKIT, &mms->iotkit,
25
- if (file_align > 0 && mr && file_align > mr->align) {
25
sizeof(mms->iotkit), mmc->armsse_type);
26
+ if (file_align > 0 && file_align > mr->align) {
26
iotkitdev = DEVICE(&mms->iotkit);
27
error_setg(errp, "backing store align 0x%" PRIx64
27
object_property_set_link(OBJECT(&mms->iotkit), OBJECT(system_memory),
28
" is larger than 'align' option 0x%" PRIx64,
29
file_align, mr->align);
28
--
30
--
29
2.20.1
31
2.20.1
30
32
31
33
diff view generated by jsdifflib
1
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
1
The realpath() function can return NULL on error, so we need to check
2
for it to avoid crashing when we try to strstr() into it.
3
This can happen if we run out of memory, or if /sys/ is not mounted,
4
among other situations.
2
5
3
Embed the ADMAs into the SoC type.
6
Fixes: Coverity 1459913, 1460474
7
Fixes: ce317be98db0 ("exec: fetch the alignment of Linux devdax pmem character device nodes")
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Jingqi Liu <jingqi.liu@intel.com>
10
Message-id: 20210812151525.31456-1-peter.maydell@linaro.org
11
---
12
softmmu/physmem.c | 3 +++
13
1 file changed, 3 insertions(+)
4
14
5
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
15
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
6
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
7
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
10
Message-id: 20200427181649.26851-7-edgar.iglesias@gmail.com
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
13
include/hw/arm/xlnx-versal.h | 3 ++-
14
hw/arm/xlnx-versal.c | 14 +++++++-------
15
2 files changed, 9 insertions(+), 8 deletions(-)
16
17
diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
18
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
19
--- a/include/hw/arm/xlnx-versal.h
17
--- a/softmmu/physmem.c
20
+++ b/include/hw/arm/xlnx-versal.h
18
+++ b/softmmu/physmem.c
21
@@ -XXX,XX +XXX,XX @@
19
@@ -XXX,XX +XXX,XX @@ static int64_t get_file_align(int fd)
22
#include "hw/arm/boot.h"
20
path = g_strdup_printf("/sys/dev/char/%d:%d",
23
#include "hw/intc/arm_gicv3.h"
21
major(st.st_rdev), minor(st.st_rdev));
24
#include "hw/char/pl011.h"
22
rpath = realpath(path, NULL);
25
+#include "hw/dma/xlnx-zdma.h"
23
+ if (!rpath) {
26
#include "hw/net/cadence_gem.h"
24
+ return -errno;
27
25
+ }
28
#define TYPE_XLNX_VERSAL "xlnx-versal"
26
29
@@ -XXX,XX +XXX,XX @@ typedef struct Versal {
27
rc = daxctl_new(&ctx);
30
struct {
28
if (rc) {
31
PL011State uart[XLNX_VERSAL_NR_UARTS];
32
CadenceGEMState gem[XLNX_VERSAL_NR_GEMS];
33
- SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS];
34
+ XlnxZDMA adma[XLNX_VERSAL_NR_ADMAS];
35
} iou;
36
} lpd;
37
38
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
39
index XXXXXXX..XXXXXXX 100644
40
--- a/hw/arm/xlnx-versal.c
41
+++ b/hw/arm/xlnx-versal.c
42
@@ -XXX,XX +XXX,XX @@ static void versal_create_admas(Versal *s, qemu_irq *pic)
43
DeviceState *dev;
44
MemoryRegion *mr;
45
46
- dev = qdev_create(NULL, "xlnx.zdma");
47
- s->lpd.iou.adma[i] = SYS_BUS_DEVICE(dev);
48
- object_property_set_int(OBJECT(s->lpd.iou.adma[i]), 128, "bus-width",
49
- &error_abort);
50
- object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal);
51
+ sysbus_init_child_obj(OBJECT(s), name,
52
+ &s->lpd.iou.adma[i], sizeof(s->lpd.iou.adma[i]),
53
+ TYPE_XLNX_ZDMA);
54
+ dev = DEVICE(&s->lpd.iou.adma[i]);
55
+ object_property_set_int(OBJECT(dev), 128, "bus-width", &error_abort);
56
qdev_init_nofail(dev);
57
58
- mr = sysbus_mmio_get_region(s->lpd.iou.adma[i], 0);
59
+ mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0);
60
memory_region_add_subregion(&s->mr_ps,
61
MM_ADMA_CH0 + i * MM_ADMA_CH0_SIZE, mr);
62
63
- sysbus_connect_irq(s->lpd.iou.adma[i], 0, pic[VERSAL_ADMA_IRQ_0 + i]);
64
+ sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[VERSAL_ADMA_IRQ_0 + i]);
65
g_free(name);
66
}
67
}
68
--
29
--
69
2.20.1
30
2.20.1
70
31
71
32
diff view generated by jsdifflib
1
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
1
We don't currently zero-initialize the 'struct sockaddr_in' that
2
parse_host_port() fills in, so any fields we don't explicitly
3
initialize might be left as random garbage. POSIX states that
4
implementations may define extensions in sockaddr_in, and that those
5
extensions must not trigger if zero-initialized. So not zero
6
initializing might result in inadvertently triggering an impdef
7
extension.
2
8
3
Embed the GEMs into the SoC type.
9
memset() the sockaddr_in before we start to fill it in.
4
10
5
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
11
Fixes: Coverity CID 1005338
6
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
7
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
10
Message-id: 20200427181649.26851-6-edgar.iglesias@gmail.com
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Reviewed-by: Eric Blake <eblake@redhat.com>
14
Message-id: 20210813150506.7768-2-peter.maydell@linaro.org
12
---
15
---
13
include/hw/arm/xlnx-versal.h | 3 ++-
16
net/net.c | 2 ++
14
hw/arm/xlnx-versal.c | 15 ++++++++-------
17
1 file changed, 2 insertions(+)
15
2 files changed, 10 insertions(+), 8 deletions(-)
16
18
17
diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
19
diff --git a/net/net.c b/net/net.c
18
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
19
--- a/include/hw/arm/xlnx-versal.h
21
--- a/net/net.c
20
+++ b/include/hw/arm/xlnx-versal.h
22
+++ b/net/net.c
21
@@ -XXX,XX +XXX,XX @@
23
@@ -XXX,XX +XXX,XX @@ int parse_host_port(struct sockaddr_in *saddr, const char *str,
22
#include "hw/arm/boot.h"
24
const char *addr, *p, *r;
23
#include "hw/intc/arm_gicv3.h"
25
int port, ret = 0;
24
#include "hw/char/pl011.h"
26
25
+#include "hw/net/cadence_gem.h"
27
+ memset(saddr, 0, sizeof(*saddr));
26
28
+
27
#define TYPE_XLNX_VERSAL "xlnx-versal"
29
substrings = g_strsplit(str, ":", 2);
28
#define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL)
30
if (!substrings || !substrings[0] || !substrings[1]) {
29
@@ -XXX,XX +XXX,XX @@ typedef struct Versal {
31
error_setg(errp, "host address '%s' doesn't contain ':' "
30
31
struct {
32
PL011State uart[XLNX_VERSAL_NR_UARTS];
33
- SysBusDevice *gem[XLNX_VERSAL_NR_GEMS];
34
+ CadenceGEMState gem[XLNX_VERSAL_NR_GEMS];
35
SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS];
36
} iou;
37
} lpd;
38
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
39
index XXXXXXX..XXXXXXX 100644
40
--- a/hw/arm/xlnx-versal.c
41
+++ b/hw/arm/xlnx-versal.c
42
@@ -XXX,XX +XXX,XX @@ static void versal_create_gems(Versal *s, qemu_irq *pic)
43
DeviceState *dev;
44
MemoryRegion *mr;
45
46
- dev = qdev_create(NULL, "cadence_gem");
47
- s->lpd.iou.gem[i] = SYS_BUS_DEVICE(dev);
48
- object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal);
49
+ sysbus_init_child_obj(OBJECT(s), name,
50
+ &s->lpd.iou.gem[i], sizeof(s->lpd.iou.gem[i]),
51
+ TYPE_CADENCE_GEM);
52
+ dev = DEVICE(&s->lpd.iou.gem[i]);
53
if (nd->used) {
54
qemu_check_nic_model(nd, "cadence_gem");
55
qdev_set_nic_properties(dev, nd);
56
}
57
- object_property_set_int(OBJECT(s->lpd.iou.gem[i]),
58
+ object_property_set_int(OBJECT(dev),
59
2, "num-priority-queues",
60
&error_abort);
61
- object_property_set_link(OBJECT(s->lpd.iou.gem[i]),
62
+ object_property_set_link(OBJECT(dev),
63
OBJECT(&s->mr_ps), "dma",
64
&error_abort);
65
qdev_init_nofail(dev);
66
67
- mr = sysbus_mmio_get_region(s->lpd.iou.gem[i], 0);
68
+ mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0);
69
memory_region_add_subregion(&s->mr_ps, addrs[i], mr);
70
71
- sysbus_connect_irq(s->lpd.iou.gem[i], 0, pic[irqs[i]]);
72
+ sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[irqs[i]]);
73
g_free(name);
74
}
75
}
76
--
32
--
77
2.20.1
33
2.20.1
78
34
79
35
diff view generated by jsdifflib
1
Convert VCMLA (scalar) in the 2reg-scalar-ext group to decodetree.
1
Zero-initialize sockaddr_in and sockaddr_un structs that we're about
2
to fill in and pass to bind() or connect(), to ensure we don't leave
3
possible implementation-defined extension fields as uninitialized
4
garbage.
2
5
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Reviewed-by: Eric Blake <eblake@redhat.com>
5
Message-id: 20200430181003.21682-9-peter.maydell@linaro.org
8
Message-id: 20210813150506.7768-3-peter.maydell@linaro.org
6
---
9
---
7
target/arm/neon-shared.decode | 5 +++++
10
gdbstub.c | 4 ++--
8
target/arm/translate-neon.inc.c | 40 +++++++++++++++++++++++++++++++++
11
1 file changed, 2 insertions(+), 2 deletions(-)
9
target/arm/translate.c | 26 +--------------------
10
3 files changed, 46 insertions(+), 25 deletions(-)
11
12
12
diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode
13
diff --git a/gdbstub.c b/gdbstub.c
13
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
14
--- a/target/arm/neon-shared.decode
15
--- a/gdbstub.c
15
+++ b/target/arm/neon-shared.decode
16
+++ b/gdbstub.c
16
@@ -XXX,XX +XXX,XX @@ VFML 1111 110 0 s:1 . 10 .... .... 1000 . 0 . 1 .... \
17
@@ -XXX,XX +XXX,XX @@ static bool gdb_accept_socket(int gdb_fd)
17
vm=%vm_sp vn=%vn_sp vd=%vd_dp q=0
18
18
VFML 1111 110 0 s:1 . 10 .... .... 1000 . 1 . 1 .... \
19
static int gdbserver_open_socket(const char *path)
19
vm=%vm_dp vn=%vn_dp vd=%vd_dp q=1
20
{
20
+
21
- struct sockaddr_un sockaddr;
21
+VCMLA_scalar 1111 1110 0 . rot:2 .... .... 1000 . q:1 index:1 0 vm:4 \
22
+ struct sockaddr_un sockaddr = {};
22
+ vn=%vn_dp vd=%vd_dp size=0
23
int fd, ret;
23
+VCMLA_scalar 1111 1110 1 . rot:2 .... .... 1000 . q:1 . 0 .... \
24
24
+ vm=%vm_dp vn=%vn_dp vd=%vd_dp size=1 index=0
25
fd = socket(AF_UNIX, SOCK_STREAM, 0);
25
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
26
@@ -XXX,XX +XXX,XX @@ static int gdbserver_open_socket(const char *path)
26
index XXXXXXX..XXXXXXX 100644
27
27
--- a/target/arm/translate-neon.inc.c
28
static bool gdb_accept_tcp(int gdb_fd)
28
+++ b/target/arm/translate-neon.inc.c
29
{
29
@@ -XXX,XX +XXX,XX @@ static bool trans_VFML(DisasContext *s, arg_VFML *a)
30
- struct sockaddr_in sockaddr;
30
gen_helper_gvec_fmlal_a32);
31
+ struct sockaddr_in sockaddr = {};
31
return true;
32
socklen_t len;
32
}
33
int fd;
33
+
34
+static bool trans_VCMLA_scalar(DisasContext *s, arg_VCMLA_scalar *a)
35
+{
36
+ gen_helper_gvec_3_ptr *fn_gvec_ptr;
37
+ int opr_sz;
38
+ TCGv_ptr fpst;
39
+
40
+ if (!dc_isar_feature(aa32_vcma, s)) {
41
+ return false;
42
+ }
43
+ if (a->size == 0 && !dc_isar_feature(aa32_fp16_arith, s)) {
44
+ return false;
45
+ }
46
+
47
+ /* UNDEF accesses to D16-D31 if they don't exist. */
48
+ if (!dc_isar_feature(aa32_simd_r32, s) &&
49
+ ((a->vd | a->vn | a->vm) & 0x10)) {
50
+ return false;
51
+ }
52
+
53
+ if ((a->vd | a->vn) & a->q) {
54
+ return false;
55
+ }
56
+
57
+ if (!vfp_access_check(s)) {
58
+ return true;
59
+ }
60
+
61
+ fn_gvec_ptr = (a->size ? gen_helper_gvec_fcmlas_idx
62
+ : gen_helper_gvec_fcmlah_idx);
63
+ opr_sz = (1 + a->q) * 8;
64
+ fpst = get_fpstatus_ptr(1);
65
+ tcg_gen_gvec_3_ptr(vfp_reg_offset(1, a->vd),
66
+ vfp_reg_offset(1, a->vn),
67
+ vfp_reg_offset(1, a->vm),
68
+ fpst, opr_sz, opr_sz,
69
+ (a->index << 2) | a->rot, fn_gvec_ptr);
70
+ tcg_temp_free_ptr(fpst);
71
+ return true;
72
+}
73
diff --git a/target/arm/translate.c b/target/arm/translate.c
74
index XXXXXXX..XXXXXXX 100644
75
--- a/target/arm/translate.c
76
+++ b/target/arm/translate.c
77
@@ -XXX,XX +XXX,XX @@ static int disas_neon_insn_2reg_scalar_ext(DisasContext *s, uint32_t insn)
78
bool is_long = false, q = extract32(insn, 6, 1);
79
bool ptr_is_env = false;
80
81
- if ((insn & 0xff000f10) == 0xfe000800) {
82
- /* VCMLA (indexed) -- 1111 1110 S.RR .... .... 1000 ...0 .... */
83
- int rot = extract32(insn, 20, 2);
84
- int size = extract32(insn, 23, 1);
85
- int index;
86
-
87
- if (!dc_isar_feature(aa32_vcma, s)) {
88
- return 1;
89
- }
90
- if (size == 0) {
91
- if (!dc_isar_feature(aa32_fp16_arith, s)) {
92
- return 1;
93
- }
94
- /* For fp16, rm is just Vm, and index is M. */
95
- rm = extract32(insn, 0, 4);
96
- index = extract32(insn, 5, 1);
97
- } else {
98
- /* For fp32, rm is the usual M:Vm, and index is 0. */
99
- VFP_DREG_M(rm, insn);
100
- index = 0;
101
- }
102
- data = (index << 2) | rot;
103
- fn_gvec_ptr = (size ? gen_helper_gvec_fcmlas_idx
104
- : gen_helper_gvec_fcmlah_idx);
105
- } else if ((insn & 0xffb00f00) == 0xfe200d00) {
106
+ if ((insn & 0xffb00f00) == 0xfe200d00) {
107
/* V[US]DOT -- 1111 1110 0.10 .... .... 1101 .Q.U .... */
108
int u = extract32(insn, 4, 1);
109
34
110
--
35
--
111
2.20.1
36
2.20.1
112
37
113
38
diff view generated by jsdifflib
1
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
1
Zero-initialize the sockaddr_in struct that we're about to fill in
2
and pass to bind(), to ensure we don't leave possible
3
implementation-defined extension fields as uninitialized garbage.
2
4
3
Move misplaced comment.
4
5
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
6
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
7
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
9
Message-id: 20200427181649.26851-3-edgar.iglesias@gmail.com
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Eric Blake <eblake@redhat.com>
7
Reviewed-by: Corey Minyard <cminyard@mvista.com>
8
Acked-by: Thomas Huth <thuth@redhat.com>
9
Message-id: 20210813150506.7768-4-peter.maydell@linaro.org
11
---
10
---
12
hw/arm/xlnx-versal.c | 2 +-
11
tests/qtest/ipmi-bt-test.c | 2 +-
13
1 file changed, 1 insertion(+), 1 deletion(-)
12
1 file changed, 1 insertion(+), 1 deletion(-)
14
13
15
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
14
diff --git a/tests/qtest/ipmi-bt-test.c b/tests/qtest/ipmi-bt-test.c
16
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/arm/xlnx-versal.c
16
--- a/tests/qtest/ipmi-bt-test.c
18
+++ b/hw/arm/xlnx-versal.c
17
+++ b/tests/qtest/ipmi-bt-test.c
19
@@ -XXX,XX +XXX,XX @@ static void versal_create_apu_cpus(Versal *s)
18
@@ -XXX,XX +XXX,XX @@ static void test_enable_irq(void)
20
19
*/
21
obj = object_new(XLNX_VERSAL_ACPU_TYPE);
20
static void open_socket(void)
22
if (!obj) {
21
{
23
- /* Secondary CPUs start in PSCI powered-down state */
22
- struct sockaddr_in myaddr;
24
error_report("Unable to create apu.cpu[%d] of type %s",
23
+ struct sockaddr_in myaddr = {};
25
i, XLNX_VERSAL_ACPU_TYPE);
24
socklen_t addrlen;
26
exit(EXIT_FAILURE);
25
27
@@ -XXX,XX +XXX,XX @@ static void versal_create_apu_cpus(Versal *s)
26
myaddr.sin_family = AF_INET;
28
object_property_set_int(obj, s->cfg.psci_conduit,
29
"psci-conduit", &error_abort);
30
if (i) {
31
+ /* Secondary CPUs start in PSCI powered-down state */
32
object_property_set_bool(obj, true,
33
"start-powered-off", &error_abort);
34
}
35
--
27
--
36
2.20.1
28
2.20.1
37
29
38
30
diff view generated by jsdifflib
1
The access_type argument to get_phys_addr_lpae() is an MMUAccessType;
1
Zero-initialize sockaddr_in and sockaddr_un structs that we're about
2
use the enum constant MMU_DATA_LOAD rather than a literal 0 when we
2
to fill in and pass to bind() or connect(), to ensure we don't leave
3
call it in S1_ptw_translate().
3
possible implementation-defined extension fields as uninitialized
4
garbage.
4
5
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
7
Reviewed-by: Eric Blake <eblake@redhat.com>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20210813150506.7768-5-peter.maydell@linaro.org
8
Message-id: 20200330210400.11724-3-peter.maydell@linaro.org
9
---
9
---
10
target/arm/helper.c | 5 +++--
10
tests/tcg/multiarch/linux-test.c | 4 ++--
11
1 file changed, 3 insertions(+), 2 deletions(-)
11
1 file changed, 2 insertions(+), 2 deletions(-)
12
12
13
diff --git a/target/arm/helper.c b/target/arm/helper.c
13
diff --git a/tests/tcg/multiarch/linux-test.c b/tests/tcg/multiarch/linux-test.c
14
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/helper.c
15
--- a/tests/tcg/multiarch/linux-test.c
16
+++ b/target/arm/helper.c
16
+++ b/tests/tcg/multiarch/linux-test.c
17
@@ -XXX,XX +XXX,XX @@ static hwaddr S1_ptw_translate(CPUARMState *env, ARMMMUIdx mmu_idx,
17
@@ -XXX,XX +XXX,XX @@ static void test_time(void)
18
pcacheattrs = &cacheattrs;
18
static int server_socket(void)
19
}
19
{
20
20
int val, fd;
21
- ret = get_phys_addr_lpae(env, addr, 0, ARMMMUIdx_Stage2, &s2pa,
21
- struct sockaddr_in sockaddr;
22
- &txattrs, &s2prot, &s2size, fi, pcacheattrs);
22
+ struct sockaddr_in sockaddr = {};
23
+ ret = get_phys_addr_lpae(env, addr, MMU_DATA_LOAD, ARMMMUIdx_Stage2,
23
24
+ &s2pa, &txattrs, &s2prot, &s2size, fi,
24
/* server socket */
25
+ pcacheattrs);
25
fd = chk_error(socket(PF_INET, SOCK_STREAM, 0));
26
if (ret) {
26
@@ -XXX,XX +XXX,XX @@ static int server_socket(void)
27
assert(fi->type != ARMFault_None);
27
static int client_socket(uint16_t port)
28
fi->s2addr = addr;
28
{
29
int fd;
30
- struct sockaddr_in sockaddr;
31
+ struct sockaddr_in sockaddr = {};
32
33
/* server socket */
34
fd = chk_error(socket(PF_INET, SOCK_STREAM, 0));
29
--
35
--
30
2.20.1
36
2.20.1
31
37
32
38
diff view generated by jsdifflib
1
We were accidentally permitting decode of Thumb Neon insns even if
1
The SoC realize can fail for legitimate reasons, because it propagates
2
the CPU didn't have the FEATURE_NEON bit set, because the feature
2
errors up from CPU realize, which in turn can be provoked by user
3
check was being done before the call to disas_neon_data_insn() and
3
error in setting commandline options. Use error_fatal so we report
4
disas_neon_ls_insn() in the Arm decoder but was omitted from the
4
the error message to the user and exit, rather than asserting
5
Thumb decoder. Push the feature bit check down into the called
5
via error_abort.
6
functions so it is done for both Arm and Thumb encodings.
7
6
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
11
Message-id: 20200430181003.21682-3-peter.maydell@linaro.org
10
Message-id: 20210816135842.25302-2-peter.maydell@linaro.org
12
---
11
---
13
target/arm/translate.c | 16 ++++++++--------
12
hw/arm/raspi.c | 2 +-
14
1 file changed, 8 insertions(+), 8 deletions(-)
13
1 file changed, 1 insertion(+), 1 deletion(-)
15
14
16
diff --git a/target/arm/translate.c b/target/arm/translate.c
15
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
17
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/translate.c
17
--- a/hw/arm/raspi.c
19
+++ b/target/arm/translate.c
18
+++ b/hw/arm/raspi.c
20
@@ -XXX,XX +XXX,XX @@ static int disas_neon_ls_insn(DisasContext *s, uint32_t insn)
19
@@ -XXX,XX +XXX,XX @@ static void raspi_machine_init(MachineState *machine)
21
TCGv_i32 tmp2;
20
object_property_add_const_link(OBJECT(&s->soc), "ram", OBJECT(machine->ram));
22
TCGv_i64 tmp64;
21
object_property_set_int(OBJECT(&s->soc), "board-rev", board_rev,
23
22
&error_abort);
24
+ if (!arm_dc_feature(s, ARM_FEATURE_NEON)) {
23
- qdev_realize(DEVICE(&s->soc), NULL, &error_abort);
25
+ return 1;
24
+ qdev_realize(DEVICE(&s->soc), NULL, &error_fatal);
26
+ }
25
27
+
26
/* Create and plug in the SD cards */
28
/* FIXME: this access check should not take precedence over UNDEF
27
di = drive_get_next(IF_SD);
29
* for invalid encodings; we will generate incorrect syndrome information
30
* for attempts to execute invalid vfp/neon encodings with FP disabled.
31
@@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
32
TCGv_ptr ptr1, ptr2, ptr3;
33
TCGv_i64 tmp64;
34
35
+ if (!arm_dc_feature(s, ARM_FEATURE_NEON)) {
36
+ return 1;
37
+ }
38
+
39
/* FIXME: this access check should not take precedence over UNDEF
40
* for invalid encodings; we will generate incorrect syndrome information
41
* for attempts to execute invalid vfp/neon encodings with FP disabled.
42
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
43
44
if (((insn >> 25) & 7) == 1) {
45
/* NEON Data processing. */
46
- if (!arm_dc_feature(s, ARM_FEATURE_NEON)) {
47
- goto illegal_op;
48
- }
49
-
50
if (disas_neon_data_insn(s, insn)) {
51
goto illegal_op;
52
}
53
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
54
}
55
if ((insn & 0x0f100000) == 0x04000000) {
56
/* NEON load/store. */
57
- if (!arm_dc_feature(s, ARM_FEATURE_NEON)) {
58
- goto illegal_op;
59
- }
60
-
61
if (disas_neon_ls_insn(s, insn)) {
62
goto illegal_op;
63
}
64
--
28
--
65
2.20.1
29
2.20.1
66
30
67
31
diff view generated by jsdifflib
1
Add the infrastructure for building and invoking a decodetree decoder
1
KVM cannot support multiple address spaces per CPU; if you try to
2
for the AArch32 Neon encodings. At the moment the new decoder covers
2
create more than one then cpu_address_space_init() will assert.
3
nothing, so we always fall back to the existing hand-written decode.
4
3
5
We follow the same pattern we did for the VFP decodetree conversion
4
In the Arm CPU realize function, detect the configurations which
6
(commit 78e138bc1f672c145ef6ace74617d and following): code that deals
5
would cause us to need more than one AS, and cleanly fail the
7
with Neon will be moving gradually out to translate-neon.vfp.inc,
6
realize rather than blundering on into the assertion. This
8
which we #include into translate.c.
7
turns this:
8
$ qemu-system-aarch64 -enable-kvm -display none -cpu max -machine raspi3b
9
qemu-system-aarch64: ../../softmmu/physmem.c:747: cpu_address_space_init: Assertion `asidx == 0 || !kvm_enabled()' failed.
10
Aborted
9
11
10
In order to share the decode files between A32 and T32, we
12
into:
11
split Neon into 3 parts:
13
$ qemu-system-aarch64 -enable-kvm -display none -machine raspi3b
12
* data-processing
14
qemu-system-aarch64: Cannot enable KVM when guest CPU has EL3 enabled
13
* load-store
14
* 'shared' encodings
15
15
16
The first two groups of instructions have similar but not identical
16
and this:
17
A32 and T32 encodings, so we need to manually transform the T32
17
$ qemu-system-aarch64 -enable-kvm -display none -machine mps3-an524
18
encoding into the A32 one before calling the decoder; the third group
18
qemu-system-aarch64: ../../softmmu/physmem.c:747: cpu_address_space_init: Assertion `asidx == 0 || !kvm_enabled()' failed.
19
covers the Neon instructions which are identical in A32 and T32.
19
Aborted
20
20
21
into:
22
$ qemu-system-aarch64 -enable-kvm -display none -machine mps3-an524
23
qemu-system-aarch64: Cannot enable KVM when using an M-profile guest CPU
24
25
Fixes: https://gitlab.com/qemu-project/qemu/-/issues/528
21
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
26
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
22
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
27
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
23
Message-id: 20200430181003.21682-4-peter.maydell@linaro.org
28
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
29
Message-id: 20210816135842.25302-3-peter.maydell@linaro.org
24
---
30
---
25
target/arm/neon-dp.decode | 29 ++++++++++++++++++++++++++
31
target/arm/cpu.c | 23 +++++++++++++++++++++++
26
target/arm/neon-ls.decode | 29 ++++++++++++++++++++++++++
32
1 file changed, 23 insertions(+)
27
target/arm/neon-shared.decode | 27 +++++++++++++++++++++++++
28
target/arm/translate-neon.inc.c | 32 +++++++++++++++++++++++++++++
29
target/arm/translate.c | 36 +++++++++++++++++++++++++++++++--
30
target/arm/Makefile.objs | 18 +++++++++++++++++
31
6 files changed, 169 insertions(+), 2 deletions(-)
32
create mode 100644 target/arm/neon-dp.decode
33
create mode 100644 target/arm/neon-ls.decode
34
create mode 100644 target/arm/neon-shared.decode
35
create mode 100644 target/arm/translate-neon.inc.c
36
33
37
diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode
34
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
38
new file mode 100644
39
index XXXXXXX..XXXXXXX
40
--- /dev/null
41
+++ b/target/arm/neon-dp.decode
42
@@ -XXX,XX +XXX,XX @@
43
+# AArch32 Neon data-processing instruction descriptions
44
+#
45
+# Copyright (c) 2020 Linaro, Ltd
46
+#
47
+# This library is free software; you can redistribute it and/or
48
+# modify it under the terms of the GNU Lesser General Public
49
+# License as published by the Free Software Foundation; either
50
+# version 2 of the License, or (at your option) any later version.
51
+#
52
+# This library is distributed in the hope that it will be useful,
53
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
54
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
55
+# Lesser General Public License for more details.
56
+#
57
+# You should have received a copy of the GNU Lesser General Public
58
+# License along with this library; if not, see <http://www.gnu.org/licenses/>.
59
+
60
+#
61
+# This file is processed by scripts/decodetree.py
62
+#
63
+
64
+# Encodings for Neon data processing instructions where the T32 encoding
65
+# is a simple transformation of the A32 encoding.
66
+# More specifically, this file covers instructions where the A32 encoding is
67
+# 0b1111_001p_qqqq_qqqq_qqqq_qqqq_qqqq_qqqq
68
+# and the T32 encoding is
69
+# 0b111p_1111_qqqq_qqqq_qqqq_qqqq_qqqq_qqqq
70
+# This file works on the A32 encoding only; calling code for T32 has to
71
+# transform the insn into the A32 version first.
72
diff --git a/target/arm/neon-ls.decode b/target/arm/neon-ls.decode
73
new file mode 100644
74
index XXXXXXX..XXXXXXX
75
--- /dev/null
76
+++ b/target/arm/neon-ls.decode
77
@@ -XXX,XX +XXX,XX @@
78
+# AArch32 Neon load/store instruction descriptions
79
+#
80
+# Copyright (c) 2020 Linaro, Ltd
81
+#
82
+# This library is free software; you can redistribute it and/or
83
+# modify it under the terms of the GNU Lesser General Public
84
+# License as published by the Free Software Foundation; either
85
+# version 2 of the License, or (at your option) any later version.
86
+#
87
+# This library is distributed in the hope that it will be useful,
88
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
89
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
90
+# Lesser General Public License for more details.
91
+#
92
+# You should have received a copy of the GNU Lesser General Public
93
+# License along with this library; if not, see <http://www.gnu.org/licenses/>.
94
+
95
+#
96
+# This file is processed by scripts/decodetree.py
97
+#
98
+
99
+# Encodings for Neon load/store instructions where the T32 encoding
100
+# is a simple transformation of the A32 encoding.
101
+# More specifically, this file covers instructions where the A32 encoding is
102
+# 0b1111_0100_xxx0_xxxx_xxxx_xxxx_xxxx_xxxx
103
+# and the T32 encoding is
104
+# 0b1111_1001_xxx0_xxxx_xxxx_xxxx_xxxx_xxxx
105
+# This file works on the A32 encoding only; calling code for T32 has to
106
+# transform the insn into the A32 version first.
107
diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode
108
new file mode 100644
109
index XXXXXXX..XXXXXXX
110
--- /dev/null
111
+++ b/target/arm/neon-shared.decode
112
@@ -XXX,XX +XXX,XX @@
113
+# AArch32 Neon instruction descriptions
114
+#
115
+# Copyright (c) 2020 Linaro, Ltd
116
+#
117
+# This library is free software; you can redistribute it and/or
118
+# modify it under the terms of the GNU Lesser General Public
119
+# License as published by the Free Software Foundation; either
120
+# version 2 of the License, or (at your option) any later version.
121
+#
122
+# This library is distributed in the hope that it will be useful,
123
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
124
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
125
+# Lesser General Public License for more details.
126
+#
127
+# You should have received a copy of the GNU Lesser General Public
128
+# License along with this library; if not, see <http://www.gnu.org/licenses/>.
129
+
130
+#
131
+# This file is processed by scripts/decodetree.py
132
+#
133
+
134
+# Encodings for Neon instructions whose encoding is the same for
135
+# both A32 and T32.
136
+
137
+# More specifically, this covers:
138
+# 2reg scalar ext: 0b1111_1110_xxxx_xxxx_xxxx_1x0x_xxxx_xxxx
139
+# 3same ext: 0b1111_110x_xxxx_xxxx_xxxx_1x0x_xxxx_xxxx
140
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
141
new file mode 100644
142
index XXXXXXX..XXXXXXX
143
--- /dev/null
144
+++ b/target/arm/translate-neon.inc.c
145
@@ -XXX,XX +XXX,XX @@
146
+/*
147
+ * ARM translation: AArch32 Neon instructions
148
+ *
149
+ * Copyright (c) 2003 Fabrice Bellard
150
+ * Copyright (c) 2005-2007 CodeSourcery
151
+ * Copyright (c) 2007 OpenedHand, Ltd.
152
+ * Copyright (c) 2020 Linaro, Ltd.
153
+ *
154
+ * This library is free software; you can redistribute it and/or
155
+ * modify it under the terms of the GNU Lesser General Public
156
+ * License as published by the Free Software Foundation; either
157
+ * version 2 of the License, or (at your option) any later version.
158
+ *
159
+ * This library is distributed in the hope that it will be useful,
160
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
161
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
162
+ * Lesser General Public License for more details.
163
+ *
164
+ * You should have received a copy of the GNU Lesser General Public
165
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
166
+ */
167
+
168
+/*
169
+ * This file is intended to be included from translate.c; it uses
170
+ * some macros and definitions provided by that file.
171
+ * It might be possible to convert it to a standalone .c file eventually.
172
+ */
173
+
174
+/* Include the generated Neon decoder */
175
+#include "decode-neon-dp.inc.c"
176
+#include "decode-neon-ls.inc.c"
177
+#include "decode-neon-shared.inc.c"
178
diff --git a/target/arm/translate.c b/target/arm/translate.c
179
index XXXXXXX..XXXXXXX 100644
35
index XXXXXXX..XXXXXXX 100644
180
--- a/target/arm/translate.c
36
--- a/target/arm/cpu.c
181
+++ b/target/arm/translate.c
37
+++ b/target/arm/cpu.c
182
@@ -XXX,XX +XXX,XX @@ static TCGv_ptr vfp_reg_ptr(bool dp, int reg)
38
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
183
184
#define ARM_CP_RW_BIT (1 << 20)
185
186
-/* Include the VFP decoder */
187
+/* Include the VFP and Neon decoders */
188
#include "translate-vfp.inc.c"
189
+#include "translate-neon.inc.c"
190
191
static inline void iwmmxt_load_reg(TCGv_i64 var, int reg)
192
{
193
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
194
/* Unconditional instructions. */
195
/* TODO: Perhaps merge these into one decodetree output file. */
196
if (disas_a32_uncond(s, insn) ||
197
- disas_vfp_uncond(s, insn)) {
198
+ disas_vfp_uncond(s, insn) ||
199
+ disas_neon_dp(s, insn) ||
200
+ disas_neon_ls(s, insn) ||
201
+ disas_neon_shared(s, insn)) {
202
return;
203
}
39
}
204
/* fall back to legacy decoder */
205
@@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn)
206
ARCH(6T2);
207
}
40
}
208
41
209
+ if ((insn & 0xef000000) == 0xef000000) {
42
+ if (kvm_enabled()) {
210
+ /*
43
+ /*
211
+ * T32 encodings 0b111p_1111_qqqq_qqqq_qqqq_qqqq_qqqq_qqqq
44
+ * Catch all the cases which might cause us to create more than one
212
+ * transform into
45
+ * address space for the CPU (otherwise we will assert() later in
213
+ * A32 encodings 0b1111_001p_qqqq_qqqq_qqqq_qqqq_qqqq_qqqq
46
+ * cpu_address_space_init()).
214
+ */
47
+ */
215
+ uint32_t a32_insn = (insn & 0xe2ffffff) |
48
+ if (arm_feature(env, ARM_FEATURE_M)) {
216
+ ((insn & (1 << 28)) >> 4) | (1 << 28);
49
+ error_setg(errp,
217
+
50
+ "Cannot enable KVM when using an M-profile guest CPU");
218
+ if (disas_neon_dp(s, a32_insn)) {
51
+ return;
52
+ }
53
+ if (cpu->has_el3) {
54
+ error_setg(errp,
55
+ "Cannot enable KVM when guest CPU has EL3 enabled");
56
+ return;
57
+ }
58
+ if (cpu->tag_memory) {
59
+ error_setg(errp,
60
+ "Cannot enable KVM when guest CPUs has MTE enabled");
219
+ return;
61
+ return;
220
+ }
62
+ }
221
+ }
63
+ }
222
+
64
+
223
+ if ((insn & 0xff100000) == 0xf9000000) {
65
{
224
+ /*
66
uint64_t scale;
225
+ * T32 encodings 0b1111_1001_ppp0_qqqq_qqqq_qqqq_qqqq_qqqq
67
226
+ * transform into
227
+ * A32 encodings 0b1111_0100_ppp0_qqqq_qqqq_qqqq_qqqq_qqqq
228
+ */
229
+ uint32_t a32_insn = (insn & 0x00ffffff) | 0xf4000000;
230
+
231
+ if (disas_neon_ls(s, a32_insn)) {
232
+ return;
233
+ }
234
+ }
235
+
236
/*
237
* TODO: Perhaps merge these into one decodetree output file.
238
* Note disas_vfp is written for a32 with cond field in the
239
@@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn)
240
*/
241
if (disas_t32(s, insn) ||
242
disas_vfp_uncond(s, insn) ||
243
+ disas_neon_shared(s, insn) ||
244
((insn >> 28) == 0xe && disas_vfp(s, insn))) {
245
return;
246
}
247
diff --git a/target/arm/Makefile.objs b/target/arm/Makefile.objs
248
index XXXXXXX..XXXXXXX 100644
249
--- a/target/arm/Makefile.objs
250
+++ b/target/arm/Makefile.objs
251
@@ -XXX,XX +XXX,XX @@ target/arm/decode-sve.inc.c: $(SRC_PATH)/target/arm/sve.decode $(DECODETREE)
252
     $(PYTHON) $(DECODETREE) --decode disas_sve -o $@ $<,\
253
     "GEN", $(TARGET_DIR)$@)
254
255
+target/arm/decode-neon-shared.inc.c: $(SRC_PATH)/target/arm/neon-shared.decode $(DECODETREE)
256
+    $(call quiet-command,\
257
+     $(PYTHON) $(DECODETREE) --static-decode disas_neon_shared -o $@ $<,\
258
+     "GEN", $(TARGET_DIR)$@)
259
+
260
+target/arm/decode-neon-dp.inc.c: $(SRC_PATH)/target/arm/neon-dp.decode $(DECODETREE)
261
+    $(call quiet-command,\
262
+     $(PYTHON) $(DECODETREE) --static-decode disas_neon_dp -o $@ $<,\
263
+     "GEN", $(TARGET_DIR)$@)
264
+
265
+target/arm/decode-neon-ls.inc.c: $(SRC_PATH)/target/arm/neon-ls.decode $(DECODETREE)
266
+    $(call quiet-command,\
267
+     $(PYTHON) $(DECODETREE) --static-decode disas_neon_ls -o $@ $<,\
268
+     "GEN", $(TARGET_DIR)$@)
269
+
270
target/arm/decode-vfp.inc.c: $(SRC_PATH)/target/arm/vfp.decode $(DECODETREE)
271
    $(call quiet-command,\
272
     $(PYTHON) $(DECODETREE) --static-decode disas_vfp -o $@ $<,\
273
@@ -XXX,XX +XXX,XX @@ target/arm/decode-t16.inc.c: $(SRC_PATH)/target/arm/t16.decode $(DECODETREE)
274
     "GEN", $(TARGET_DIR)$@)
275
276
target/arm/translate-sve.o: target/arm/decode-sve.inc.c
277
+target/arm/translate.o: target/arm/decode-neon-shared.inc.c
278
+target/arm/translate.o: target/arm/decode-neon-dp.inc.c
279
+target/arm/translate.o: target/arm/decode-neon-ls.inc.c
280
target/arm/translate.o: target/arm/decode-vfp.inc.c
281
target/arm/translate.o: target/arm/decode-vfp-uncond.inc.c
282
target/arm/translate.o: target/arm/decode-a32.inc.c
283
--
68
--
284
2.20.1
69
2.20.1
285
70
286
71
diff view generated by jsdifflib
1
Somewhere along theline we accidentally added a duplicate
1
Now that the CPU realize function will fail cleanly if we ask for EL3
2
"using D16-D31 when they don't exist" check to do_vfm_dp()
2
when KVM is enabled, we don't need to check for errors explicitly in
3
(probably an artifact of a patchseries rebase). Remove it.
3
the virt board code. The reported message is slightly different;
4
it is now:
5
qemu-system-aarch64: Cannot enable KVM when guest CPU has EL3 enabled
6
instead of:
7
qemu-system-aarch64: mach-virt: KVM does not support Security extensions
8
9
We don't delete the MTE check because there the logic is more
10
complex; deleting the check would work but makes the error message
11
less helpful, as it would read:
12
qemu-system-aarch64: MTE requested, but not supported by the guest CPU
13
instead of:
14
qemu-system-aarch64: mach-virt: KVM does not support providing MTE to the guest CPU
4
15
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
17
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
18
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
Message-id: 20200430181003.21682-2-peter.maydell@linaro.org
19
Message-id: 20210816135842.25302-4-peter.maydell@linaro.org
9
---
20
---
10
target/arm/translate-vfp.inc.c | 6 ------
21
hw/arm/virt.c | 5 -----
11
1 file changed, 6 deletions(-)
22
1 file changed, 5 deletions(-)
12
23
13
diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c
24
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
14
index XXXXXXX..XXXXXXX 100644
25
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/translate-vfp.inc.c
26
--- a/hw/arm/virt.c
16
+++ b/target/arm/translate-vfp.inc.c
27
+++ b/hw/arm/virt.c
17
@@ -XXX,XX +XXX,XX @@ static bool do_vfm_dp(DisasContext *s, arg_VFMA_dp *a, bool neg_n, bool neg_d)
28
@@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine)
18
return false;
19
}
29
}
20
30
21
- /* UNDEF accesses to D16-D31 if they don't exist. */
31
if (vms->secure) {
22
- if (!dc_isar_feature(aa32_simd_r32, s) &&
32
- if (kvm_enabled()) {
23
- ((a->vd | a->vn | a->vm) & 0x10)) {
33
- error_report("mach-virt: KVM does not support Security extensions");
24
- return false;
34
- exit(1);
25
- }
35
- }
26
-
36
-
27
if (!vfp_access_check(s)) {
37
/*
28
return true;
38
* The Secure view of the world is the same as the NonSecure,
29
}
39
* but with a few extra devices. Create it as a container region
30
--
40
--
31
2.20.1
41
2.20.1
32
42
33
43
diff view generated by jsdifflib
1
We define ARMMMUIdx_Stage2 as being an MMU index which uses a QEMU
1
In v7, the HSTR register has a TTEE bit which allows EL0/EL1 accesses
2
TLB. However we never actually use the TLB -- all stage 2 lookups
2
to the Thumb2EE TEECR and TEEHBR registers to be trapped to the
3
are done by direct calls to get_phys_addr_lpae() followed by a
3
hypervisor. Implement these traps.
4
physical address load via address_space_ld*().
5
6
Remove Stage2 from the list of ARM MMU indexes which correspond to
7
real core MMU indexes, and instead put it in the set of "NOTLB" ARM
8
MMU indexes.
9
10
This allows us to drop NB_MMU_MODES to 11. It also means we can
11
safely add support for the ARMv8.3-TTS2UXN extension, which adds
12
permission bits to the stage 2 descriptors which define execute
13
permission separatel for EL0 and EL1; supporting that while keeping
14
Stage2 in a QEMU TLB would require us to use separate TLBs for
15
"Stage2 for an EL0 access" and "Stage2 for an EL1 access", which is a
16
lot of extra complication given we aren't even using the QEMU TLB.
17
18
In the process of updating the comment on our MMU index use,
19
fix a couple of other minor errors:
20
* NS EL2 EL2&0 was missing from the list in the comment
21
* some text hadn't been updated from when we bumped NB_MMU_MODES
22
above 8
23
4
24
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
25
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
26
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
27
Message-id: 20200330210400.11724-2-peter.maydell@linaro.org
7
Message-id: 20210816180305.20137-2-peter.maydell@linaro.org
28
---
8
---
29
target/arm/cpu-param.h | 2 +-
9
target/arm/cpu.h | 2 ++
30
target/arm/cpu.h | 21 +++++---
10
target/arm/helper.c | 18 ++++++++++++++++--
31
target/arm/helper.c | 112 ++++-------------------------------------
11
2 files changed, 18 insertions(+), 2 deletions(-)
32
3 files changed, 27 insertions(+), 108 deletions(-)
33
12
34
diff --git a/target/arm/cpu-param.h b/target/arm/cpu-param.h
35
index XXXXXXX..XXXXXXX 100644
36
--- a/target/arm/cpu-param.h
37
+++ b/target/arm/cpu-param.h
38
@@ -XXX,XX +XXX,XX @@
39
# define TARGET_PAGE_BITS_MIN 10
40
#endif
41
42
-#define NB_MMU_MODES 12
43
+#define NB_MMU_MODES 11
44
45
#endif
46
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
13
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
47
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
48
--- a/target/arm/cpu.h
15
--- a/target/arm/cpu.h
49
+++ b/target/arm/cpu.h
16
+++ b/target/arm/cpu.h
50
@@ -XXX,XX +XXX,XX @@ bool write_cpustate_to_list(ARMCPU *cpu, bool kvm_sync);
17
@@ -XXX,XX +XXX,XX @@ static inline void xpsr_write(CPUARMState *env, uint32_t val, uint32_t mask)
51
* handling via the TLB. The only way to do a stage 1 translation without
18
#define SCR_ENSCXT (1U << 25)
52
* the immediate stage 2 translation is via the ATS or AT system insns,
19
#define SCR_ATA (1U << 26)
53
* which can be slow-pathed and always do a page table walk.
20
54
+ * The only use of stage 2 translations is either as part of an s1+2
21
+#define HSTR_TTEE (1 << 16)
55
+ * lookup or when loading the descriptors during a stage 1 page table walk,
22
+
56
+ * and in both those cases we don't use the TLB.
23
/* Return the current FPSCR value. */
57
* 4. we can also safely fold together the "32 bit EL3" and "64 bit EL3"
24
uint32_t vfp_get_fpscr(CPUARMState *env);
58
* translation regimes, because they map reasonably well to each other
25
void vfp_set_fpscr(CPUARMState *env, uint32_t val);
59
* and they can't both be active at the same time.
60
@@ -XXX,XX +XXX,XX @@ bool write_cpustate_to_list(ARMCPU *cpu, bool kvm_sync);
61
* NS EL1 EL1&0 stage 1+2 (aka NS PL1)
62
* NS EL1 EL1&0 stage 1+2 +PAN
63
* NS EL0 EL2&0
64
+ * NS EL2 EL2&0
65
* NS EL2 EL2&0 +PAN
66
* NS EL2 (aka NS PL2)
67
* S EL0 EL1&0 (aka S PL0)
68
* S EL1 EL1&0 (not used if EL3 is 32 bit)
69
* S EL1 EL1&0 +PAN
70
* S EL3 (aka S PL1)
71
- * NS EL1&0 stage 2
72
*
73
- * for a total of 12 different mmu_idx.
74
+ * for a total of 11 different mmu_idx.
75
*
76
* R profile CPUs have an MPU, but can use the same set of MMU indexes
77
* as A profile. They only need to distinguish NS EL0 and NS EL1 (and
78
@@ -XXX,XX +XXX,XX @@ bool write_cpustate_to_list(ARMCPU *cpu, bool kvm_sync);
79
* are not quite the same -- different CPU types (most notably M profile
80
* vs A/R profile) would like to use MMU indexes with different semantics,
81
* but since we don't ever need to use all of those in a single CPU we
82
- * can avoid setting NB_MMU_MODES to more than 8. The lower bits of
83
+ * can avoid having to set NB_MMU_MODES to "total number of A profile MMU
84
+ * modes + total number of M profile MMU modes". The lower bits of
85
* ARMMMUIdx are the core TLB mmu index, and the higher bits are always
86
* the same for any particular CPU.
87
* Variables of type ARMMUIdx are always full values, and the core
88
@@ -XXX,XX +XXX,XX @@ typedef enum ARMMMUIdx {
89
ARMMMUIdx_SE10_1_PAN = 9 | ARM_MMU_IDX_A,
90
ARMMMUIdx_SE3 = 10 | ARM_MMU_IDX_A,
91
92
- ARMMMUIdx_Stage2 = 11 | ARM_MMU_IDX_A,
93
-
94
/*
95
* These are not allocated TLBs and are used only for AT system
96
* instructions or for the first stage of an S12 page table walk.
97
@@ -XXX,XX +XXX,XX @@ typedef enum ARMMMUIdx {
98
ARMMMUIdx_Stage1_E0 = 0 | ARM_MMU_IDX_NOTLB,
99
ARMMMUIdx_Stage1_E1 = 1 | ARM_MMU_IDX_NOTLB,
100
ARMMMUIdx_Stage1_E1_PAN = 2 | ARM_MMU_IDX_NOTLB,
101
+ /*
102
+ * Not allocated a TLB: used only for second stage of an S12 page
103
+ * table walk, or for descriptor loads during first stage of an S1
104
+ * page table walk. Note that if we ever want to have a TLB for this
105
+ * then various TLB flush insns which currently are no-ops or flush
106
+ * only stage 1 MMU indexes will need to change to flush stage 2.
107
+ */
108
+ ARMMMUIdx_Stage2 = 3 | ARM_MMU_IDX_NOTLB,
109
110
/*
111
* M-profile.
112
@@ -XXX,XX +XXX,XX @@ typedef enum ARMMMUIdxBit {
113
TO_CORE_BIT(SE10_1),
114
TO_CORE_BIT(SE10_1_PAN),
115
TO_CORE_BIT(SE3),
116
- TO_CORE_BIT(Stage2),
117
118
TO_CORE_BIT(MUser),
119
TO_CORE_BIT(MPriv),
120
diff --git a/target/arm/helper.c b/target/arm/helper.c
26
diff --git a/target/arm/helper.c b/target/arm/helper.c
121
index XXXXXXX..XXXXXXX 100644
27
index XXXXXXX..XXXXXXX 100644
122
--- a/target/arm/helper.c
28
--- a/target/arm/helper.c
123
+++ b/target/arm/helper.c
29
+++ b/target/arm/helper.c
124
@@ -XXX,XX +XXX,XX @@ static void tlbiall_nsnh_write(CPUARMState *env, const ARMCPRegInfo *ri,
30
@@ -XXX,XX +XXX,XX @@ static void teecr_write(CPUARMState *env, const ARMCPRegInfo *ri,
125
tlb_flush_by_mmuidx(cs,
31
env->teecr = value;
126
ARMMMUIdxBit_E10_1 |
127
ARMMMUIdxBit_E10_1_PAN |
128
- ARMMMUIdxBit_E10_0 |
129
- ARMMMUIdxBit_Stage2);
130
+ ARMMMUIdxBit_E10_0);
131
}
32
}
132
33
133
static void tlbiall_nsnh_is_write(CPUARMState *env, const ARMCPRegInfo *ri,
34
+static CPAccessResult teecr_access(CPUARMState *env, const ARMCPRegInfo *ri,
134
@@ -XXX,XX +XXX,XX @@ static void tlbiall_nsnh_is_write(CPUARMState *env, const ARMCPRegInfo *ri,
35
+ bool isread)
135
tlb_flush_by_mmuidx_all_cpus_synced(cs,
36
+{
136
ARMMMUIdxBit_E10_1 |
37
+ /*
137
ARMMMUIdxBit_E10_1_PAN |
38
+ * HSTR.TTEE only exists in v7A, not v8A, but v8A doesn't have T2EE
138
- ARMMMUIdxBit_E10_0 |
39
+ * at all, so we don't need to check whether we're v8A.
139
- ARMMMUIdxBit_Stage2);
40
+ */
140
+ ARMMMUIdxBit_E10_0);
41
+ if (arm_current_el(env) < 2 && !arm_is_secure_below_el3(env) &&
42
+ (env->cp15.hstr_el2 & HSTR_TTEE)) {
43
+ return CP_ACCESS_TRAP_EL2;
44
+ }
45
+ return CP_ACCESS_OK;
46
+}
47
+
48
static CPAccessResult teehbr_access(CPUARMState *env, const ARMCPRegInfo *ri,
49
bool isread)
50
{
51
if (arm_current_el(env) == 0 && (env->teecr & 1)) {
52
return CP_ACCESS_TRAP;
53
}
54
- return CP_ACCESS_OK;
55
+ return teecr_access(env, ri, isread);
141
}
56
}
142
57
143
-static void tlbiipas2_write(CPUARMState *env, const ARMCPRegInfo *ri,
58
static const ARMCPRegInfo t2ee_cp_reginfo[] = {
144
- uint64_t value)
59
{ .name = "TEECR", .cp = 14, .crn = 0, .crm = 0, .opc1 = 6, .opc2 = 0,
145
-{
60
.access = PL1_RW, .fieldoffset = offsetof(CPUARMState, teecr),
146
- /* Invalidate by IPA. This has to invalidate any structures that
61
.resetvalue = 0,
147
- * contain only stage 2 translation information, but does not need
62
- .writefn = teecr_write },
148
- * to apply to structures that contain combined stage 1 and stage 2
63
+ .writefn = teecr_write, .accessfn = teecr_access },
149
- * translation information.
64
{ .name = "TEEHBR", .cp = 14, .crn = 1, .crm = 0, .opc1 = 6, .opc2 = 0,
150
- * This must NOP if EL2 isn't implemented or SCR_EL3.NS is zero.
65
.access = PL0_RW, .fieldoffset = offsetof(CPUARMState, teehbr),
151
- */
66
.accessfn = teehbr_access, .resetvalue = 0 },
152
- CPUState *cs = env_cpu(env);
153
- uint64_t pageaddr;
154
-
155
- if (!arm_feature(env, ARM_FEATURE_EL2) || !(env->cp15.scr_el3 & SCR_NS)) {
156
- return;
157
- }
158
-
159
- pageaddr = sextract64(value << 12, 0, 40);
160
-
161
- tlb_flush_page_by_mmuidx(cs, pageaddr, ARMMMUIdxBit_Stage2);
162
-}
163
-
164
-static void tlbiipas2_is_write(CPUARMState *env, const ARMCPRegInfo *ri,
165
- uint64_t value)
166
-{
167
- CPUState *cs = env_cpu(env);
168
- uint64_t pageaddr;
169
-
170
- if (!arm_feature(env, ARM_FEATURE_EL2) || !(env->cp15.scr_el3 & SCR_NS)) {
171
- return;
172
- }
173
-
174
- pageaddr = sextract64(value << 12, 0, 40);
175
-
176
- tlb_flush_page_by_mmuidx_all_cpus_synced(cs, pageaddr,
177
- ARMMMUIdxBit_Stage2);
178
-}
179
180
static void tlbiall_hyp_write(CPUARMState *env, const ARMCPRegInfo *ri,
181
uint64_t value)
182
@@ -XXX,XX +XXX,XX @@ static void vttbr_write(CPUARMState *env, const ARMCPRegInfo *ri,
183
tlb_flush_by_mmuidx(cs,
184
ARMMMUIdxBit_E10_1 |
185
ARMMMUIdxBit_E10_1_PAN |
186
- ARMMMUIdxBit_E10_0 |
187
- ARMMMUIdxBit_Stage2);
188
+ ARMMMUIdxBit_E10_0);
189
raw_write(env, ri, value);
190
}
191
}
192
@@ -XXX,XX +XXX,XX @@ static int alle1_tlbmask(CPUARMState *env)
193
return ARMMMUIdxBit_SE10_1 |
194
ARMMMUIdxBit_SE10_1_PAN |
195
ARMMMUIdxBit_SE10_0;
196
- } else if (arm_feature(env, ARM_FEATURE_EL2)) {
197
- return ARMMMUIdxBit_E10_1 |
198
- ARMMMUIdxBit_E10_1_PAN |
199
- ARMMMUIdxBit_E10_0 |
200
- ARMMMUIdxBit_Stage2;
201
} else {
202
return ARMMMUIdxBit_E10_1 |
203
ARMMMUIdxBit_E10_1_PAN |
204
@@ -XXX,XX +XXX,XX @@ static void tlbi_aa64_vae3is_write(CPUARMState *env, const ARMCPRegInfo *ri,
205
ARMMMUIdxBit_SE3);
206
}
207
208
-static void tlbi_aa64_ipas2e1_write(CPUARMState *env, const ARMCPRegInfo *ri,
209
- uint64_t value)
210
-{
211
- /* Invalidate by IPA. This has to invalidate any structures that
212
- * contain only stage 2 translation information, but does not need
213
- * to apply to structures that contain combined stage 1 and stage 2
214
- * translation information.
215
- * This must NOP if EL2 isn't implemented or SCR_EL3.NS is zero.
216
- */
217
- ARMCPU *cpu = env_archcpu(env);
218
- CPUState *cs = CPU(cpu);
219
- uint64_t pageaddr;
220
-
221
- if (!arm_feature(env, ARM_FEATURE_EL2) || !(env->cp15.scr_el3 & SCR_NS)) {
222
- return;
223
- }
224
-
225
- pageaddr = sextract64(value << 12, 0, 48);
226
-
227
- tlb_flush_page_by_mmuidx(cs, pageaddr, ARMMMUIdxBit_Stage2);
228
-}
229
-
230
-static void tlbi_aa64_ipas2e1is_write(CPUARMState *env, const ARMCPRegInfo *ri,
231
- uint64_t value)
232
-{
233
- CPUState *cs = env_cpu(env);
234
- uint64_t pageaddr;
235
-
236
- if (!arm_feature(env, ARM_FEATURE_EL2) || !(env->cp15.scr_el3 & SCR_NS)) {
237
- return;
238
- }
239
-
240
- pageaddr = sextract64(value << 12, 0, 48);
241
-
242
- tlb_flush_page_by_mmuidx_all_cpus_synced(cs, pageaddr,
243
- ARMMMUIdxBit_Stage2);
244
-}
245
-
246
static CPAccessResult aa64_zva_access(CPUARMState *env, const ARMCPRegInfo *ri,
247
bool isread)
248
{
249
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
250
.writefn = tlbi_aa64_vae1_write },
251
{ .name = "TLBI_IPAS2E1IS", .state = ARM_CP_STATE_AA64,
252
.opc0 = 1, .opc1 = 4, .crn = 8, .crm = 0, .opc2 = 1,
253
- .access = PL2_W, .type = ARM_CP_NO_RAW,
254
- .writefn = tlbi_aa64_ipas2e1is_write },
255
+ .access = PL2_W, .type = ARM_CP_NOP },
256
{ .name = "TLBI_IPAS2LE1IS", .state = ARM_CP_STATE_AA64,
257
.opc0 = 1, .opc1 = 4, .crn = 8, .crm = 0, .opc2 = 5,
258
- .access = PL2_W, .type = ARM_CP_NO_RAW,
259
- .writefn = tlbi_aa64_ipas2e1is_write },
260
+ .access = PL2_W, .type = ARM_CP_NOP },
261
{ .name = "TLBI_ALLE1IS", .state = ARM_CP_STATE_AA64,
262
.opc0 = 1, .opc1 = 4, .crn = 8, .crm = 3, .opc2 = 4,
263
.access = PL2_W, .type = ARM_CP_NO_RAW,
264
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
265
.writefn = tlbi_aa64_alle1is_write },
266
{ .name = "TLBI_IPAS2E1", .state = ARM_CP_STATE_AA64,
267
.opc0 = 1, .opc1 = 4, .crn = 8, .crm = 4, .opc2 = 1,
268
- .access = PL2_W, .type = ARM_CP_NO_RAW,
269
- .writefn = tlbi_aa64_ipas2e1_write },
270
+ .access = PL2_W, .type = ARM_CP_NOP },
271
{ .name = "TLBI_IPAS2LE1", .state = ARM_CP_STATE_AA64,
272
.opc0 = 1, .opc1 = 4, .crn = 8, .crm = 4, .opc2 = 5,
273
- .access = PL2_W, .type = ARM_CP_NO_RAW,
274
- .writefn = tlbi_aa64_ipas2e1_write },
275
+ .access = PL2_W, .type = ARM_CP_NOP },
276
{ .name = "TLBI_ALLE1", .state = ARM_CP_STATE_AA64,
277
.opc0 = 1, .opc1 = 4, .crn = 8, .crm = 7, .opc2 = 4,
278
.access = PL2_W, .type = ARM_CP_NO_RAW,
279
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
280
.writefn = tlbimva_hyp_is_write },
281
{ .name = "TLBIIPAS2",
282
.cp = 15, .opc1 = 4, .crn = 8, .crm = 4, .opc2 = 1,
283
- .type = ARM_CP_NO_RAW, .access = PL2_W,
284
- .writefn = tlbiipas2_write },
285
+ .type = ARM_CP_NOP, .access = PL2_W },
286
{ .name = "TLBIIPAS2IS",
287
.cp = 15, .opc1 = 4, .crn = 8, .crm = 0, .opc2 = 1,
288
- .type = ARM_CP_NO_RAW, .access = PL2_W,
289
- .writefn = tlbiipas2_is_write },
290
+ .type = ARM_CP_NOP, .access = PL2_W },
291
{ .name = "TLBIIPAS2L",
292
.cp = 15, .opc1 = 4, .crn = 8, .crm = 4, .opc2 = 5,
293
- .type = ARM_CP_NO_RAW, .access = PL2_W,
294
- .writefn = tlbiipas2_write },
295
+ .type = ARM_CP_NOP, .access = PL2_W },
296
{ .name = "TLBIIPAS2LIS",
297
.cp = 15, .opc1 = 4, .crn = 8, .crm = 0, .opc2 = 5,
298
- .type = ARM_CP_NO_RAW, .access = PL2_W,
299
- .writefn = tlbiipas2_is_write },
300
+ .type = ARM_CP_NOP, .access = PL2_W },
301
/* 32 bit cache operations */
302
{ .name = "ICIALLUIS", .cp = 15, .opc1 = 0, .crn = 7, .crm = 1, .opc2 = 0,
303
.type = ARM_CP_NOP, .access = PL1_W, .accessfn = aa64_cacheop_pou_access },
304
--
67
--
305
2.20.1
68
2.20.1
306
69
307
70
diff view generated by jsdifflib
1
The ARMv8.2-TTS2UXN feature extends the XN field in stage 2
1
In v7A, the HSTR register has a TJDBX bit which traps NS EL0/EL1
2
translation table descriptors from just bit [54] to bits [54:53],
2
access to the JOSCR and JMCR trivial Jazelle registers, and also BXJ.
3
allowing stage 2 to control execution permissions separately for EL0
3
Implement these traps. In v8A this HSTR bit doesn't exist, so don't
4
and EL1. Implement the new semantics of the XN field and enable
4
trap for v8A CPUs.
5
the feature for our 'max' CPU.
6
5
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Message-id: 20200330210400.11724-5-peter.maydell@linaro.org
8
Message-id: 20210816180305.20137-3-peter.maydell@linaro.org
11
---
9
---
12
target/arm/cpu.h | 15 +++++++++++++++
10
target/arm/cpu.h | 1 +
13
target/arm/cpu.c | 1 +
11
target/arm/helper.h | 2 ++
14
target/arm/cpu64.c | 2 ++
12
target/arm/syndrome.h | 7 +++++++
15
target/arm/helper.c | 37 +++++++++++++++++++++++++++++++------
13
target/arm/helper.c | 17 +++++++++++++++++
16
4 files changed, 49 insertions(+), 6 deletions(-)
14
target/arm/op_helper.c | 16 ++++++++++++++++
15
target/arm/translate.c | 12 ++++++++++++
16
6 files changed, 55 insertions(+)
17
17
18
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
18
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
19
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
20
--- a/target/arm/cpu.h
20
--- a/target/arm/cpu.h
21
+++ b/target/arm/cpu.h
21
+++ b/target/arm/cpu.h
22
@@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa32_ccidx(const ARMISARegisters *id)
22
@@ -XXX,XX +XXX,XX @@ static inline void xpsr_write(CPUARMState *env, uint32_t val, uint32_t mask)
23
return FIELD_EX32(id->id_mmfr4, ID_MMFR4, CCIDX) != 0;
23
#define SCR_ATA (1U << 26)
24
25
#define HSTR_TTEE (1 << 16)
26
+#define HSTR_TJDBX (1 << 17)
27
28
/* Return the current FPSCR value. */
29
uint32_t vfp_get_fpscr(CPUARMState *env);
30
diff --git a/target/arm/helper.h b/target/arm/helper.h
31
index XXXXXXX..XXXXXXX 100644
32
--- a/target/arm/helper.h
33
+++ b/target/arm/helper.h
34
@@ -XXX,XX +XXX,XX @@ DEF_HELPER_2(v7m_vlldm, void, env, i32)
35
36
DEF_HELPER_2(v8m_stackcheck, void, env, i32)
37
38
+DEF_HELPER_FLAGS_2(check_bxj_trap, TCG_CALL_NO_WG, void, env, i32)
39
+
40
DEF_HELPER_4(access_check_cp_reg, void, env, ptr, i32, i32)
41
DEF_HELPER_3(set_cp_reg, void, env, ptr, i32)
42
DEF_HELPER_2(get_cp_reg, i32, env, ptr)
43
diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h
44
index XXXXXXX..XXXXXXX 100644
45
--- a/target/arm/syndrome.h
46
+++ b/target/arm/syndrome.h
47
@@ -XXX,XX +XXX,XX @@ enum arm_exception_class {
48
EC_ADVSIMDFPACCESSTRAP = 0x07,
49
EC_FPIDTRAP = 0x08,
50
EC_PACTRAP = 0x09,
51
+ EC_BXJTRAP = 0x0a,
52
EC_CP14RRTTRAP = 0x0c,
53
EC_BTITRAP = 0x0d,
54
EC_ILLEGALSTATE = 0x0e,
55
@@ -XXX,XX +XXX,XX @@ static inline uint32_t syn_btitrap(int btype)
56
return (EC_BTITRAP << ARM_EL_EC_SHIFT) | btype;
24
}
57
}
25
58
26
+static inline bool isar_feature_aa32_tts2uxn(const ARMISARegisters *id)
59
+static inline uint32_t syn_bxjtrap(int cv, int cond, int rm)
27
+{
60
+{
28
+ return FIELD_EX32(id->id_mmfr4, ID_MMFR4, XNX) != 0;
61
+ return (EC_BXJTRAP << ARM_EL_EC_SHIFT) | ARM_EL_IL |
62
+ (cv << 24) | (cond << 20) | rm;
29
+}
63
+}
30
+
64
+
31
/*
65
static inline uint32_t syn_insn_abort(int same_el, int ea, int s1ptw, int fsc)
32
* 64-bit feature tests via id registers.
66
{
33
*/
67
return (EC_INSNABORT << ARM_EL_EC_SHIFT) | (same_el << ARM_EL_EC_SHIFT)
34
@@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_ccidx(const ARMISARegisters *id)
35
return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, CCIDX) != 0;
36
}
37
38
+static inline bool isar_feature_aa64_tts2uxn(const ARMISARegisters *id)
39
+{
40
+ return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, XNX) != 0;
41
+}
42
+
43
/*
44
* Feature tests for "does this exist in either 32-bit or 64-bit?"
45
*/
46
@@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_any_ccidx(const ARMISARegisters *id)
47
return isar_feature_aa64_ccidx(id) || isar_feature_aa32_ccidx(id);
48
}
49
50
+static inline bool isar_feature_any_tts2uxn(const ARMISARegisters *id)
51
+{
52
+ return isar_feature_aa64_tts2uxn(id) || isar_feature_aa32_tts2uxn(id);
53
+}
54
+
55
/*
56
* Forward to the above feature tests given an ARMCPU pointer.
57
*/
58
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
59
index XXXXXXX..XXXXXXX 100644
60
--- a/target/arm/cpu.c
61
+++ b/target/arm/cpu.c
62
@@ -XXX,XX +XXX,XX @@ static void arm_max_initfn(Object *obj)
63
t = FIELD_DP32(t, ID_MMFR4, HPDS, 1); /* AA32HPD */
64
t = FIELD_DP32(t, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */
65
t = FIELD_DP32(t, ID_MMFR4, CNP, 1); /* TTCNP */
66
+ t = FIELD_DP32(t, ID_MMFR4, XNX, 1); /* TTS2UXN */
67
cpu->isar.id_mmfr4 = t;
68
}
69
#endif
70
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
71
index XXXXXXX..XXXXXXX 100644
72
--- a/target/arm/cpu64.c
73
+++ b/target/arm/cpu64.c
74
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
75
t = FIELD_DP64(t, ID_AA64MMFR1, VH, 1);
76
t = FIELD_DP64(t, ID_AA64MMFR1, PAN, 2); /* ATS1E1 */
77
t = FIELD_DP64(t, ID_AA64MMFR1, VMIDBITS, 2); /* VMID16 */
78
+ t = FIELD_DP64(t, ID_AA64MMFR1, XNX, 1); /* TTS2UXN */
79
cpu->isar.id_aa64mmfr1 = t;
80
81
t = cpu->isar.id_aa64mmfr2;
82
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
83
u = FIELD_DP32(u, ID_MMFR4, HPDS, 1); /* AA32HPD */
84
u = FIELD_DP32(u, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */
85
u = FIELD_DP32(u, ID_MMFR4, CNP, 1); /* TTCNP */
86
+ u = FIELD_DP32(u, ID_MMFR4, XNX, 1); /* TTS2UXN */
87
cpu->isar.id_mmfr4 = u;
88
89
u = cpu->isar.id_aa64dfr0;
90
diff --git a/target/arm/helper.c b/target/arm/helper.c
68
diff --git a/target/arm/helper.c b/target/arm/helper.c
91
index XXXXXXX..XXXXXXX 100644
69
index XXXXXXX..XXXXXXX 100644
92
--- a/target/arm/helper.c
70
--- a/target/arm/helper.c
93
+++ b/target/arm/helper.c
71
+++ b/target/arm/helper.c
94
@@ -XXX,XX +XXX,XX @@ simple_ap_to_rw_prot(CPUARMState *env, ARMMMUIdx mmu_idx, int ap)
72
@@ -XXX,XX +XXX,XX @@ static CPAccessResult access_jazelle(CPUARMState *env, const ARMCPRegInfo *ri,
95
*
73
return CP_ACCESS_OK;
96
* @env: CPUARMState
74
}
97
* @s2ap: The 2-bit stage2 access permissions (S2AP)
75
98
- * @xn: XN (execute-never) bit
76
+static CPAccessResult access_joscr_jmcr(CPUARMState *env,
99
+ * @xn: XN (execute-never) bits
77
+ const ARMCPRegInfo *ri, bool isread)
100
+ * @s1_is_el0: true if this is S2 of an S1+2 walk for EL0
78
+{
101
*/
79
+ /*
102
-static int get_S2prot(CPUARMState *env, int s2ap, int xn)
80
+ * HSTR.TJDBX traps JOSCR and JMCR accesses, but it exists only
103
+static int get_S2prot(CPUARMState *env, int s2ap, int xn, bool s1_is_el0)
81
+ * in v7A, not in v8A.
104
{
82
+ */
105
int prot = 0;
83
+ if (!arm_feature(env, ARM_FEATURE_V8) &&
106
84
+ arm_current_el(env) < 2 && !arm_is_secure_below_el3(env) &&
107
@@ -XXX,XX +XXX,XX @@ static int get_S2prot(CPUARMState *env, int s2ap, int xn)
85
+ (env->cp15.hstr_el2 & HSTR_TJDBX)) {
108
if (s2ap & 2) {
86
+ return CP_ACCESS_TRAP_EL2;
109
prot |= PAGE_WRITE;
87
+ }
88
+ return CP_ACCESS_OK;
89
+}
90
+
91
static const ARMCPRegInfo jazelle_regs[] = {
92
{ .name = "JIDR",
93
.cp = 14, .crn = 0, .crm = 0, .opc1 = 7, .opc2 = 0,
94
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo jazelle_regs[] = {
95
.type = ARM_CP_CONST, .resetvalue = 0 },
96
{ .name = "JOSCR",
97
.cp = 14, .crn = 1, .crm = 0, .opc1 = 7, .opc2 = 0,
98
+ .accessfn = access_joscr_jmcr,
99
.access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
100
{ .name = "JMCR",
101
.cp = 14, .crn = 2, .crm = 0, .opc1 = 7, .opc2 = 0,
102
+ .accessfn = access_joscr_jmcr,
103
.access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
104
REGINFO_SENTINEL
105
};
106
diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c
107
index XXXXXXX..XXXXXXX 100644
108
--- a/target/arm/op_helper.c
109
+++ b/target/arm/op_helper.c
110
@@ -XXX,XX +XXX,XX @@ void HELPER(setend)(CPUARMState *env)
111
arm_rebuild_hflags(env);
112
}
113
114
+void HELPER(check_bxj_trap)(CPUARMState *env, uint32_t rm)
115
+{
116
+ /*
117
+ * Only called if in NS EL0 or EL1 for a BXJ for a v7A CPU;
118
+ * check if HSTR.TJDBX means we need to trap to EL2.
119
+ */
120
+ if (env->cp15.hstr_el2 & HSTR_TJDBX) {
121
+ /*
122
+ * We know the condition code check passed, so take the IMPDEF
123
+ * choice to always report CV=1 COND 0xe
124
+ */
125
+ uint32_t syn = syn_bxjtrap(1, 0xe, rm);
126
+ raise_exception_ra(env, EXCP_HYP_TRAP, syn, 2, GETPC());
127
+ }
128
+}
129
+
130
#ifndef CONFIG_USER_ONLY
131
/* Function checks whether WFx (WFI/WFE) instructions are set up to be trapped.
132
* The function returns the target EL (1-3) if the instruction is to be trapped;
133
diff --git a/target/arm/translate.c b/target/arm/translate.c
134
index XXXXXXX..XXXXXXX 100644
135
--- a/target/arm/translate.c
136
+++ b/target/arm/translate.c
137
@@ -XXX,XX +XXX,XX @@ static bool trans_BXJ(DisasContext *s, arg_BXJ *a)
138
if (!ENABLE_ARCH_5J || arm_dc_feature(s, ARM_FEATURE_M)) {
139
return false;
110
}
140
}
111
- if (!xn) {
141
+ /*
112
- if (arm_el_is_aa64(env, 2) || prot & PAGE_READ) {
142
+ * v7A allows BXJ to be trapped via HSTR.TJDBX. We don't waste a
113
+
143
+ * TBFLAGS bit on a basically-never-happens case, so call a helper
114
+ if (cpu_isar_feature(any_tts2uxn, env_archcpu(env))) {
144
+ * function to check for the trap and raise the exception if needed
115
+ switch (xn) {
145
+ * (passing it the register number for the syndrome value).
116
+ case 0:
146
+ * v8A doesn't have this HSTR bit.
117
prot |= PAGE_EXEC;
147
+ */
118
+ break;
148
+ if (!arm_dc_feature(s, ARM_FEATURE_V8) &&
119
+ case 1:
149
+ arm_dc_feature(s, ARM_FEATURE_EL2) &&
120
+ if (s1_is_el0) {
150
+ s->current_el < 2 && s->ns) {
121
+ prot |= PAGE_EXEC;
151
+ gen_helper_check_bxj_trap(cpu_env, tcg_constant_i32(a->rm));
122
+ }
152
+ }
123
+ break;
153
/* Trivial implementation equivalent to bx. */
124
+ case 2:
154
gen_bx(s, load_reg(s, a->rm));
125
+ break;
155
return true;
126
+ case 3:
127
+ if (!s1_is_el0) {
128
+ prot |= PAGE_EXEC;
129
+ }
130
+ break;
131
+ default:
132
+ g_assert_not_reached();
133
+ }
134
+ } else {
135
+ if (!extract32(xn, 1, 1)) {
136
+ if (arm_el_is_aa64(env, 2) || prot & PAGE_READ) {
137
+ prot |= PAGE_EXEC;
138
+ }
139
}
140
}
141
return prot;
142
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,
143
}
144
145
ap = extract32(attrs, 4, 2);
146
- xn = extract32(attrs, 12, 1);
147
148
if (mmu_idx == ARMMMUIdx_Stage2) {
149
ns = true;
150
- *prot = get_S2prot(env, ap, xn);
151
+ xn = extract32(attrs, 11, 2);
152
+ *prot = get_S2prot(env, ap, xn, s1_is_el0);
153
} else {
154
ns = extract32(attrs, 3, 1);
155
+ xn = extract32(attrs, 12, 1);
156
pxn = extract32(attrs, 11, 1);
157
*prot = get_S1prot(env, mmu_idx, aarch64, ap, ns, xn, pxn);
158
}
159
--
156
--
160
2.20.1
157
2.20.1
161
158
162
159
diff view generated by jsdifflib
1
For ARMv8.2-TTS2UXN, the stage 2 page table walk wants to know
1
Currently we rely on all the callsites of cpsr_write() to rebuild the
2
whether the stage 1 access is for EL0 or not, because whether
2
cached hflags if they change one of the CPSR bits which we use as a
3
exec permission is given can depend on whether this is an EL0
3
TB flag and cache in hflags. This is a bit awkward when we want to
4
or EL1 access. Add a new argument to get_phys_addr_lpae() so
4
change the set of CPSR bits that we cache, because it means we need
5
the call sites can pass this information in.
5
to re-audit all the cpsr_write() callsites to see which flags they
6
are writing and whether they now need to rebuild the hflags.
6
7
7
Since get_phys_addr_lpae() doesn't already have a doc comment,
8
Switch instead to making cpsr_write() call arm_rebuild_hflags()
8
add one so we have a place to put the documentation of the
9
itself if one of the bits being changed is a cached bit.
9
semantics of the new s1_is_el0 argument.
10
11
We don't do the rebuild for the CPSRWriteRaw write type, because that
12
kind of write is generally doing something special anyway. For the
13
CPSRWriteRaw callsites in the KVM code and inbound migration we
14
definitely don't want to recalculate the hflags; the callsites in
15
boot.c and arm-powerctl.c have to do a rebuild-hflags call themselves
16
anyway because of other CPU state changes they make.
17
18
This allows us to drop explicit arm_rebuild_hflags() calls in a
19
couple of places where the only reason we needed to call it was the
20
CPSR write.
21
22
This fixes a bug where we were incorrectly failing to rebuild hflags
23
in the code path for a gdbstub write to CPSR, which meant that you
24
could make QEMU assert by breaking into a running guest, altering the
25
CPSR to change the value of, for example, CPSR.E, and then
26
continuing.
10
27
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
28
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
29
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Message-id: 20200330210400.11724-4-peter.maydell@linaro.org
30
Message-id: 20210817201843.3829-1-peter.maydell@linaro.org
15
---
31
---
16
target/arm/helper.c | 29 ++++++++++++++++++++++++++++-
32
target/arm/cpu.h | 10 ++++++++--
17
1 file changed, 28 insertions(+), 1 deletion(-)
33
linux-user/arm/signal.c | 2 --
34
target/arm/helper.c | 5 +++++
35
3 files changed, 13 insertions(+), 4 deletions(-)
18
36
37
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
38
index XXXXXXX..XXXXXXX 100644
39
--- a/target/arm/cpu.h
40
+++ b/target/arm/cpu.h
41
@@ -XXX,XX +XXX,XX @@ uint32_t cpsr_read(CPUARMState *env);
42
typedef enum CPSRWriteType {
43
CPSRWriteByInstr = 0, /* from guest MSR or CPS */
44
CPSRWriteExceptionReturn = 1, /* from guest exception return insn */
45
- CPSRWriteRaw = 2, /* trust values, do not switch reg banks */
46
+ CPSRWriteRaw = 2,
47
+ /* trust values, no reg bank switch, no hflags rebuild */
48
CPSRWriteByGDBStub = 3, /* from the GDB stub */
49
} CPSRWriteType;
50
51
-/* Set the CPSR. Note that some bits of mask must be all-set or all-clear.*/
52
+/*
53
+ * Set the CPSR. Note that some bits of mask must be all-set or all-clear.
54
+ * This will do an arm_rebuild_hflags() if any of the bits in @mask
55
+ * correspond to TB flags bits cached in the hflags, unless @write_type
56
+ * is CPSRWriteRaw.
57
+ */
58
void cpsr_write(CPUARMState *env, uint32_t val, uint32_t mask,
59
CPSRWriteType write_type);
60
61
diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c
62
index XXXXXXX..XXXXXXX 100644
63
--- a/linux-user/arm/signal.c
64
+++ b/linux-user/arm/signal.c
65
@@ -XXX,XX +XXX,XX @@ setup_return(CPUARMState *env, struct target_sigaction *ka,
66
env->regs[14] = retcode;
67
env->regs[15] = handler & (thumb ? ~1 : ~3);
68
cpsr_write(env, cpsr, CPSR_IT | CPSR_T | CPSR_E, CPSRWriteByInstr);
69
- arm_rebuild_hflags(env);
70
71
return 0;
72
}
73
@@ -XXX,XX +XXX,XX @@ restore_sigcontext(CPUARMState *env, struct target_sigcontext *sc)
74
__get_user(env->regs[15], &sc->arm_pc);
75
__get_user(cpsr, &sc->arm_cpsr);
76
cpsr_write(env, cpsr, CPSR_USER | CPSR_EXEC, CPSRWriteByInstr);
77
- arm_rebuild_hflags(env);
78
79
err |= !valid_user_regs(env);
80
19
diff --git a/target/arm/helper.c b/target/arm/helper.c
81
diff --git a/target/arm/helper.c b/target/arm/helper.c
20
index XXXXXXX..XXXXXXX 100644
82
index XXXXXXX..XXXXXXX 100644
21
--- a/target/arm/helper.c
83
--- a/target/arm/helper.c
22
+++ b/target/arm/helper.c
84
+++ b/target/arm/helper.c
23
@@ -XXX,XX +XXX,XX @@
85
@@ -XXX,XX +XXX,XX @@ void cpsr_write(CPUARMState *env, uint32_t val, uint32_t mask,
24
86
CPSRWriteType write_type)
25
static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,
87
{
26
MMUAccessType access_type, ARMMMUIdx mmu_idx,
88
uint32_t changed_daif;
27
+ bool s1_is_el0,
89
+ bool rebuild_hflags = (write_type != CPSRWriteRaw) &&
28
hwaddr *phys_ptr, MemTxAttrs *txattrs, int *prot,
90
+ (mask & (CPSR_M | CPSR_E | CPSR_IL));
29
target_ulong *page_size_ptr,
91
30
ARMMMUFaultInfo *fi, ARMCacheAttrs *cacheattrs);
92
if (mask & CPSR_NZCV) {
31
@@ -XXX,XX +XXX,XX @@ static hwaddr S1_ptw_translate(CPUARMState *env, ARMMMUIdx mmu_idx,
93
env->ZF = (~val) & CPSR_Z;
32
}
94
@@ -XXX,XX +XXX,XX @@ void cpsr_write(CPUARMState *env, uint32_t val, uint32_t mask,
33
95
}
34
ret = get_phys_addr_lpae(env, addr, MMU_DATA_LOAD, ARMMMUIdx_Stage2,
96
mask &= ~CACHED_CPSR_BITS;
35
+ false,
97
env->uncached_cpsr = (env->uncached_cpsr & ~mask) | (val & mask);
36
&s2pa, &txattrs, &s2prot, &s2size, fi,
98
+ if (rebuild_hflags) {
37
pcacheattrs);
99
+ arm_rebuild_hflags(env);
38
if (ret) {
100
+ }
39
@@ -XXX,XX +XXX,XX @@ static ARMVAParameters aa32_va_parameters(CPUARMState *env, uint32_t va,
40
};
41
}
101
}
42
102
43
+/**
103
/* Sign/zero extend */
44
+ * get_phys_addr_lpae: perform one stage of page table walk, LPAE format
45
+ *
46
+ * Returns false if the translation was successful. Otherwise, phys_ptr, attrs,
47
+ * prot and page_size may not be filled in, and the populated fsr value provides
48
+ * information on why the translation aborted, in the format of a long-format
49
+ * DFSR/IFSR fault register, with the following caveats:
50
+ * * the WnR bit is never set (the caller must do this).
51
+ *
52
+ * @env: CPUARMState
53
+ * @address: virtual address to get physical address for
54
+ * @access_type: MMU_DATA_LOAD, MMU_DATA_STORE or MMU_INST_FETCH
55
+ * @mmu_idx: MMU index indicating required translation regime
56
+ * @s1_is_el0: if @mmu_idx is ARMMMUIdx_Stage2 (so this is a stage 2 page table
57
+ * walk), must be true if this is stage 2 of a stage 1+2 walk for an
58
+ * EL0 access). If @mmu_idx is anything else, @s1_is_el0 is ignored.
59
+ * @phys_ptr: set to the physical address corresponding to the virtual address
60
+ * @attrs: set to the memory transaction attributes to use
61
+ * @prot: set to the permissions for the page containing phys_ptr
62
+ * @page_size_ptr: set to the size of the page containing phys_ptr
63
+ * @fi: set to fault info if the translation fails
64
+ * @cacheattrs: (if non-NULL) set to the cacheability/shareability attributes
65
+ */
66
static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,
67
MMUAccessType access_type, ARMMMUIdx mmu_idx,
68
+ bool s1_is_el0,
69
hwaddr *phys_ptr, MemTxAttrs *txattrs, int *prot,
70
target_ulong *page_size_ptr,
71
ARMMMUFaultInfo *fi, ARMCacheAttrs *cacheattrs)
72
@@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address,
73
74
/* S1 is done. Now do S2 translation. */
75
ret = get_phys_addr_lpae(env, ipa, access_type, ARMMMUIdx_Stage2,
76
+ mmu_idx == ARMMMUIdx_E10_0,
77
phys_ptr, attrs, &s2_prot,
78
page_size, fi,
79
cacheattrs != NULL ? &cacheattrs2 : NULL);
80
@@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address,
81
}
82
83
if (regime_using_lpae_format(env, mmu_idx)) {
84
- return get_phys_addr_lpae(env, address, access_type, mmu_idx,
85
+ return get_phys_addr_lpae(env, address, access_type, mmu_idx, false,
86
phys_ptr, attrs, prot, page_size,
87
fi, cacheattrs);
88
} else if (regime_sctlr(env, mmu_idx) & SCTLR_XP) {
89
--
104
--
90
2.20.1
105
2.20.1
91
106
92
107
diff view generated by jsdifflib
Deleted patch
1
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
2
1
3
Remove inclusion of arm_gicv3_common.h, this already gets
4
included via xlnx-versal.h.
5
6
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
7
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
8
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
9
Message-id: 20200427181649.26851-2-edgar.iglesias@gmail.com
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
12
hw/arm/xlnx-versal.c | 1 -
13
1 file changed, 1 deletion(-)
14
15
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
16
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/arm/xlnx-versal.c
18
+++ b/hw/arm/xlnx-versal.c
19
@@ -XXX,XX +XXX,XX @@
20
#include "hw/arm/boot.h"
21
#include "kvm_arm.h"
22
#include "hw/misc/unimp.h"
23
-#include "hw/intc/arm_gicv3_common.h"
24
#include "hw/arm/xlnx-versal.h"
25
#include "hw/char/pl011.h"
26
27
--
28
2.20.1
29
30
diff view generated by jsdifflib
Deleted patch
1
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
2
1
3
Embed the UARTs into the SoC type.
4
5
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
7
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
10
Message-id: 20200427181649.26851-5-edgar.iglesias@gmail.com
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
13
include/hw/arm/xlnx-versal.h | 3 ++-
14
hw/arm/xlnx-versal.c | 12 ++++++------
15
2 files changed, 8 insertions(+), 7 deletions(-)
16
17
diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
18
index XXXXXXX..XXXXXXX 100644
19
--- a/include/hw/arm/xlnx-versal.h
20
+++ b/include/hw/arm/xlnx-versal.h
21
@@ -XXX,XX +XXX,XX @@
22
#include "hw/sysbus.h"
23
#include "hw/arm/boot.h"
24
#include "hw/intc/arm_gicv3.h"
25
+#include "hw/char/pl011.h"
26
27
#define TYPE_XLNX_VERSAL "xlnx-versal"
28
#define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL)
29
@@ -XXX,XX +XXX,XX @@ typedef struct Versal {
30
MemoryRegion mr_ocm;
31
32
struct {
33
- SysBusDevice *uart[XLNX_VERSAL_NR_UARTS];
34
+ PL011State uart[XLNX_VERSAL_NR_UARTS];
35
SysBusDevice *gem[XLNX_VERSAL_NR_GEMS];
36
SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS];
37
} iou;
38
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
39
index XXXXXXX..XXXXXXX 100644
40
--- a/hw/arm/xlnx-versal.c
41
+++ b/hw/arm/xlnx-versal.c
42
@@ -XXX,XX +XXX,XX @@
43
#include "kvm_arm.h"
44
#include "hw/misc/unimp.h"
45
#include "hw/arm/xlnx-versal.h"
46
-#include "hw/char/pl011.h"
47
48
#define XLNX_VERSAL_ACPU_TYPE ARM_CPU_TYPE_NAME("cortex-a72")
49
#define GEM_REVISION 0x40070106
50
@@ -XXX,XX +XXX,XX @@ static void versal_create_uarts(Versal *s, qemu_irq *pic)
51
DeviceState *dev;
52
MemoryRegion *mr;
53
54
- dev = qdev_create(NULL, TYPE_PL011);
55
- s->lpd.iou.uart[i] = SYS_BUS_DEVICE(dev);
56
+ sysbus_init_child_obj(OBJECT(s), name,
57
+ &s->lpd.iou.uart[i], sizeof(s->lpd.iou.uart[i]),
58
+ TYPE_PL011);
59
+ dev = DEVICE(&s->lpd.iou.uart[i]);
60
qdev_prop_set_chr(dev, "chardev", serial_hd(i));
61
- object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal);
62
qdev_init_nofail(dev);
63
64
- mr = sysbus_mmio_get_region(s->lpd.iou.uart[i], 0);
65
+ mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0);
66
memory_region_add_subregion(&s->mr_ps, addrs[i], mr);
67
68
- sysbus_connect_irq(s->lpd.iou.uart[i], 0, pic[irqs[i]]);
69
+ sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[irqs[i]]);
70
g_free(name);
71
}
72
}
73
--
74
2.20.1
75
76
diff view generated by jsdifflib
1
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
1
From: Tong Ho <tong.ho@xilinx.com>
2
2
3
Add support for SD.
3
Add unimplemented APU mmio region to xlnx-versal for booting
4
bare-metal guests built with standalone bsp, which access the
5
region from one of the following places:
6
https://github.com/Xilinx/embeddedsw/blob/release-2020.2/lib/bsp/standalone/src/arm/ARMv8/64bit/armclang/boot.S#L139
7
https://github.com/Xilinx/embeddedsw/blob/release-2020.2/lib/bsp/standalone/src/arm/ARMv8/64bit/gcc/boot.S#L183
4
8
5
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
9
Acked-by: Alistair Francis <alistair.francis@wdc.com>
6
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
10
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
7
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
11
Signed-off-by: Tong Ho <tong.ho@xilinx.com>
8
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
12
Message-id: 20210823173818.201259-2-tong.ho@xilinx.com
9
Message-id: 20200427181649.26851-9-edgar.iglesias@gmail.com
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
14
---
12
include/hw/arm/xlnx-versal.h | 12 ++++++++++++
15
include/hw/arm/xlnx-versal.h | 2 ++
13
hw/arm/xlnx-versal.c | 31 +++++++++++++++++++++++++++++++
16
hw/arm/xlnx-versal.c | 2 ++
14
2 files changed, 43 insertions(+)
17
2 files changed, 4 insertions(+)
15
18
16
diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
19
diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
17
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
18
--- a/include/hw/arm/xlnx-versal.h
21
--- a/include/hw/arm/xlnx-versal.h
19
+++ b/include/hw/arm/xlnx-versal.h
22
+++ b/include/hw/arm/xlnx-versal.h
20
@@ -XXX,XX +XXX,XX @@
23
@@ -XXX,XX +XXX,XX @@ struct Versal {
21
24
#define MM_IOU_SCNTRS_SIZE 0x10000
22
#include "hw/sysbus.h"
23
#include "hw/arm/boot.h"
24
+#include "hw/sd/sdhci.h"
25
#include "hw/intc/arm_gicv3.h"
26
#include "hw/char/pl011.h"
27
#include "hw/dma/xlnx-zdma.h"
28
@@ -XXX,XX +XXX,XX @@
29
#define XLNX_VERSAL_NR_UARTS 2
30
#define XLNX_VERSAL_NR_GEMS 2
31
#define XLNX_VERSAL_NR_ADMAS 8
32
+#define XLNX_VERSAL_NR_SDS 2
33
#define XLNX_VERSAL_NR_IRQS 192
34
35
typedef struct Versal {
36
@@ -XXX,XX +XXX,XX @@ typedef struct Versal {
37
} iou;
38
} lpd;
39
40
+ /* The Platform Management Controller subsystem. */
41
+ struct {
42
+ struct {
43
+ SDHCIState sd[XLNX_VERSAL_NR_SDS];
44
+ } iou;
45
+ } pmc;
46
+
47
struct {
48
MemoryRegion *mr_ddr;
49
uint32_t psci_conduit;
50
@@ -XXX,XX +XXX,XX @@ typedef struct Versal {
51
#define VERSAL_GEM1_IRQ_0 58
52
#define VERSAL_GEM1_WAKE_IRQ_0 59
53
#define VERSAL_ADMA_IRQ_0 60
54
+#define VERSAL_SD0_IRQ_0 126
55
56
/* Architecturally reserved IRQs suitable for virtualization. */
57
#define VERSAL_RSVD_IRQ_FIRST 111
58
@@ -XXX,XX +XXX,XX @@ typedef struct Versal {
59
#define MM_FPD_CRF 0xfd1a0000U
25
#define MM_FPD_CRF 0xfd1a0000U
60
#define MM_FPD_CRF_SIZE 0x140000
26
#define MM_FPD_CRF_SIZE 0x140000
61
27
+#define MM_FPD_FPD_APU 0xfd5c0000
62
+#define MM_PMC_SD0 0xf1040000U
28
+#define MM_FPD_FPD_APU_SIZE 0x100
63
+#define MM_PMC_SD0_SIZE 0x10000
29
64
#define MM_PMC_CRP 0xf1260000U
30
#define MM_PMC_SD0 0xf1040000U
65
#define MM_PMC_CRP_SIZE 0x10000
31
#define MM_PMC_SD0_SIZE 0x10000
66
#endif
67
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
32
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
68
index XXXXXXX..XXXXXXX 100644
33
index XXXXXXX..XXXXXXX 100644
69
--- a/hw/arm/xlnx-versal.c
34
--- a/hw/arm/xlnx-versal.c
70
+++ b/hw/arm/xlnx-versal.c
35
+++ b/hw/arm/xlnx-versal.c
71
@@ -XXX,XX +XXX,XX @@ static void versal_create_admas(Versal *s, qemu_irq *pic)
36
@@ -XXX,XX +XXX,XX @@ static void versal_unimp(Versal *s)
72
}
37
MM_CRL, MM_CRL_SIZE);
73
}
38
versal_unimp_area(s, "crf", &s->mr_ps,
74
39
MM_FPD_CRF, MM_FPD_CRF_SIZE);
75
+#define SDHCI_CAPABILITIES 0x280737ec6481 /* Same as on ZynqMP. */
40
+ versal_unimp_area(s, "apu", &s->mr_ps,
76
+static void versal_create_sds(Versal *s, qemu_irq *pic)
41
+ MM_FPD_FPD_APU, MM_FPD_FPD_APU_SIZE);
77
+{
42
versal_unimp_area(s, "crp", &s->mr_ps,
78
+ int i;
43
MM_PMC_CRP, MM_PMC_CRP_SIZE);
79
+
44
versal_unimp_area(s, "iou-scntr", &s->mr_ps,
80
+ for (i = 0; i < ARRAY_SIZE(s->pmc.iou.sd); i++) {
81
+ DeviceState *dev;
82
+ MemoryRegion *mr;
83
+
84
+ sysbus_init_child_obj(OBJECT(s), "sd[*]",
85
+ &s->pmc.iou.sd[i], sizeof(s->pmc.iou.sd[i]),
86
+ TYPE_SYSBUS_SDHCI);
87
+ dev = DEVICE(&s->pmc.iou.sd[i]);
88
+
89
+ object_property_set_uint(OBJECT(dev),
90
+ 3, "sd-spec-version", &error_fatal);
91
+ object_property_set_uint(OBJECT(dev), SDHCI_CAPABILITIES, "capareg",
92
+ &error_fatal);
93
+ object_property_set_uint(OBJECT(dev), UHS_I, "uhs", &error_fatal);
94
+ qdev_init_nofail(dev);
95
+
96
+ mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0);
97
+ memory_region_add_subregion(&s->mr_ps,
98
+ MM_PMC_SD0 + i * MM_PMC_SD0_SIZE, mr);
99
+
100
+ sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0,
101
+ pic[VERSAL_SD0_IRQ_0 + i * 2]);
102
+ }
103
+}
104
+
105
/* This takes the board allocated linear DDR memory and creates aliases
106
* for each split DDR range/aperture on the Versal address map.
107
*/
108
@@ -XXX,XX +XXX,XX @@ static void versal_realize(DeviceState *dev, Error **errp)
109
versal_create_uarts(s, pic);
110
versal_create_gems(s, pic);
111
versal_create_admas(s, pic);
112
+ versal_create_sds(s, pic);
113
versal_map_ddr(s);
114
versal_unimp(s);
115
116
--
45
--
117
2.20.1
46
2.20.1
118
47
119
48
diff view generated by jsdifflib
1
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
1
From: Tong Ho <tong.ho@xilinx.com>
2
2
3
Add support for SD.
3
Add unimplemented APU mmio region to xlnx-zynqmp for booting
4
bare-metal guests built with standalone bsp, which access the
5
region from one of the following places:
6
https://github.com/Xilinx/embeddedsw/blob/release-2020.2/lib/bsp/standalone/src/arm/ARMv8/64bit/armclang/boot.S#L139
7
https://github.com/Xilinx/embeddedsw/blob/release-2020.2/lib/bsp/standalone/src/arm/ARMv8/64bit/gcc/boot.S#L183
4
8
5
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
9
Acked-by: Alistair Francis <alistair.francis@wdc.com>
6
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
10
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
7
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
11
Signed-off-by: Tong Ho <tong.ho@xilinx.com>
8
Message-id: 20200427181649.26851-11-edgar.iglesias@gmail.com
12
Message-id: 20210823173818.201259-3-tong.ho@xilinx.com
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
14
---
11
hw/arm/xlnx-versal-virt.c | 46 +++++++++++++++++++++++++++++++++++++++
15
include/hw/arm/xlnx-zynqmp.h | 7 +++++++
12
1 file changed, 46 insertions(+)
16
hw/arm/xlnx-zynqmp.c | 32 ++++++++++++++++++++++++++++++++
17
2 files changed, 39 insertions(+)
13
18
14
diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
19
diff --git a/include/hw/arm/xlnx-zynqmp.h b/include/hw/arm/xlnx-zynqmp.h
15
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/arm/xlnx-versal-virt.c
21
--- a/include/hw/arm/xlnx-zynqmp.h
17
+++ b/hw/arm/xlnx-versal-virt.c
22
+++ b/include/hw/arm/xlnx-zynqmp.h
23
@@ -XXX,XX +XXX,XX @@ OBJECT_DECLARE_SIMPLE_TYPE(XlnxZynqMPState, XLNX_ZYNQMP)
24
#define XLNX_ZYNQMP_MAX_RAM_SIZE (XLNX_ZYNQMP_MAX_LOW_RAM_SIZE + \
25
XLNX_ZYNQMP_MAX_HIGH_RAM_SIZE)
26
27
+/*
28
+ * Unimplemented mmio regions needed to boot some images.
29
+ */
30
+#define XLNX_ZYNQMP_NUM_UNIMP_AREAS 1
31
+
32
struct XlnxZynqMPState {
33
/*< private >*/
34
DeviceState parent_obj;
35
@@ -XXX,XX +XXX,XX @@ struct XlnxZynqMPState {
36
MemoryRegion *ddr_ram;
37
MemoryRegion ddr_ram_low, ddr_ram_high;
38
39
+ MemoryRegion mr_unimp[XLNX_ZYNQMP_NUM_UNIMP_AREAS];
40
+
41
CadenceGEMState gem[XLNX_ZYNQMP_NUM_GEMS];
42
CadenceUARTState uart[XLNX_ZYNQMP_NUM_UARTS];
43
XlnxZynqMPCANState can[XLNX_ZYNQMP_NUM_CAN];
44
diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c
45
index XXXXXXX..XXXXXXX 100644
46
--- a/hw/arm/xlnx-zynqmp.c
47
+++ b/hw/arm/xlnx-zynqmp.c
18
@@ -XXX,XX +XXX,XX @@
48
@@ -XXX,XX +XXX,XX @@
19
#include "hw/arm/sysbus-fdt.h"
49
#include "qemu/module.h"
20
#include "hw/arm/fdt.h"
50
#include "hw/arm/xlnx-zynqmp.h"
21
#include "cpu.h"
51
#include "hw/intc/arm_gic_common.h"
22
+#include "hw/qdev-properties.h"
52
+#include "hw/misc/unimp.h"
23
#include "hw/arm/xlnx-versal.h"
53
#include "hw/boards.h"
24
54
#include "sysemu/kvm.h"
25
#define TYPE_XLNX_VERSAL_VIRT_MACHINE MACHINE_TYPE_NAME("xlnx-versal-virt")
55
#include "sysemu/sysemu.h"
26
@@ -XXX,XX +XXX,XX @@ static void fdt_add_zdma_nodes(VersalVirt *s)
56
@@ -XXX,XX +XXX,XX @@
27
}
57
#define DPDMA_ADDR 0xfd4c0000
58
#define DPDMA_IRQ 116
59
60
+#define APU_ADDR 0xfd5c0000
61
+#define APU_SIZE 0x100
62
+
63
#define IPI_ADDR 0xFF300000
64
#define IPI_IRQ 64
65
66
@@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_create_rpu(MachineState *ms, XlnxZynqMPState *s,
67
qdev_realize(DEVICE(&s->rpu_cluster), NULL, &error_fatal);
28
}
68
}
29
69
30
+static void fdt_add_sd_nodes(VersalVirt *s)
70
+static void xlnx_zynqmp_create_unimp_mmio(XlnxZynqMPState *s)
31
+{
71
+{
32
+ const char clocknames[] = "clk_xin\0clk_ahb";
72
+ static const struct UnimpInfo {
33
+ const char compat[] = "arasan,sdhci-8.9a";
73
+ const char *name;
34
+ int i;
74
+ hwaddr base;
75
+ hwaddr size;
76
+ } unimp_areas[ARRAY_SIZE(s->mr_unimp)] = {
77
+ { .name = "apu", APU_ADDR, APU_SIZE },
78
+ };
79
+ unsigned int nr;
35
+
80
+
36
+ for (i = ARRAY_SIZE(s->soc.pmc.iou.sd) - 1; i >= 0; i--) {
81
+ for (nr = 0; nr < ARRAY_SIZE(unimp_areas); nr++) {
37
+ uint64_t addr = MM_PMC_SD0 + MM_PMC_SD0_SIZE * i;
82
+ const struct UnimpInfo *info = &unimp_areas[nr];
38
+ char *name = g_strdup_printf("/sdhci@%" PRIx64, addr);
83
+ DeviceState *dev = qdev_new(TYPE_UNIMPLEMENTED_DEVICE);
84
+ SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
39
+
85
+
40
+ qemu_fdt_add_subnode(s->fdt, name);
86
+ assert(info->name && info->base && info->size > 0);
87
+ qdev_prop_set_string(dev, "name", info->name);
88
+ qdev_prop_set_uint64(dev, "size", info->size);
89
+ object_property_add_child(OBJECT(s), info->name, OBJECT(dev));
41
+
90
+
42
+ qemu_fdt_setprop_cells(s->fdt, name, "clocks",
91
+ sysbus_realize_and_unref(sbd, &error_fatal);
43
+ s->phandle.clk_25Mhz, s->phandle.clk_25Mhz);
92
+ sysbus_mmio_map(sbd, 0, info->base);
44
+ qemu_fdt_setprop(s->fdt, name, "clock-names",
45
+ clocknames, sizeof(clocknames));
46
+ qemu_fdt_setprop_cells(s->fdt, name, "interrupts",
47
+ GIC_FDT_IRQ_TYPE_SPI, VERSAL_SD0_IRQ_0 + i * 2,
48
+ GIC_FDT_IRQ_FLAGS_LEVEL_HI);
49
+ qemu_fdt_setprop_sized_cells(s->fdt, name, "reg",
50
+ 2, addr, 2, MM_PMC_SD0_SIZE);
51
+ qemu_fdt_setprop(s->fdt, name, "compatible", compat, sizeof(compat));
52
+ g_free(name);
53
+ }
93
+ }
54
+}
94
+}
55
+
95
+
56
static void fdt_nop_memory_nodes(void *fdt, Error **errp)
96
static void xlnx_zynqmp_init(Object *obj)
57
{
97
{
58
Error *err = NULL;
98
MachineState *ms = MACHINE(qdev_get_machine());
59
@@ -XXX,XX +XXX,XX @@ static void create_virtio_regions(VersalVirt *s)
99
@@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
60
}
100
sysbus_mmio_map(SYS_BUS_DEVICE(&s->rtc), 0, RTC_ADDR);
61
}
101
sysbus_connect_irq(SYS_BUS_DEVICE(&s->rtc), 0, gic_spi[RTC_IRQ]);
62
102
63
+static void sd_plugin_card(SDHCIState *sd, DriveInfo *di)
103
+ xlnx_zynqmp_create_unimp_mmio(s);
64
+{
65
+ BlockBackend *blk = di ? blk_by_legacy_dinfo(di) : NULL;
66
+ DeviceState *card;
67
+
104
+
68
+ card = qdev_create(qdev_get_child_bus(DEVICE(sd), "sd-bus"), TYPE_SD_CARD);
105
for (i = 0; i < XLNX_ZYNQMP_NUM_GDMA_CH; i++) {
69
+ object_property_add_child(OBJECT(sd), "card[*]", OBJECT(card),
106
if (!object_property_set_uint(OBJECT(&s->gdma[i]), "bus-width", 128,
70
+ &error_fatal);
107
errp)) {
71
+ qdev_prop_set_drive(card, "drive", blk, &error_fatal);
72
+ object_property_set_bool(OBJECT(card), true, "realized", &error_fatal);
73
+}
74
+
75
static void versal_virt_init(MachineState *machine)
76
{
77
VersalVirt *s = XLNX_VERSAL_VIRT_MACHINE(machine);
78
int psci_conduit = QEMU_PSCI_CONDUIT_DISABLED;
79
+ int i;
80
81
/*
82
* If the user provides an Operating System to be loaded, we expect them
83
@@ -XXX,XX +XXX,XX @@ static void versal_virt_init(MachineState *machine)
84
fdt_add_gic_nodes(s);
85
fdt_add_timer_nodes(s);
86
fdt_add_zdma_nodes(s);
87
+ fdt_add_sd_nodes(s);
88
fdt_add_cpu_nodes(s, psci_conduit);
89
fdt_add_clk_node(s, "/clk125", 125000000, s->phandle.clk_125Mhz);
90
fdt_add_clk_node(s, "/clk25", 25000000, s->phandle.clk_25Mhz);
91
@@ -XXX,XX +XXX,XX @@ static void versal_virt_init(MachineState *machine)
92
memory_region_add_subregion_overlap(get_system_memory(),
93
0, &s->soc.fpd.apu.mr, 0);
94
95
+ /* Plugin SD cards. */
96
+ for (i = 0; i < ARRAY_SIZE(s->soc.pmc.iou.sd); i++) {
97
+ sd_plugin_card(&s->soc.pmc.iou.sd[i], drive_get_next(IF_SD));
98
+ }
99
+
100
s->binfo.ram_size = machine->ram_size;
101
s->binfo.loader_start = 0x0;
102
s->binfo.get_dtb = versal_virt_get_dtb;
103
--
108
--
104
2.20.1
109
2.20.1
105
110
106
111
diff view generated by jsdifflib