1
Hi; here's the first target-arm pullreq for the 7.0 cycle.
1
First arm pullreq of the 8.0 series...
2
2
3
thanks
3
The following changes since commit ae2b87341b5ddb0dcb1b3f2d4f586ef18de75873:
4
-- PMM
5
4
6
The following changes since commit 76b56fdfc9fa43ec6e5986aee33f108c6c6a511e:
5
Merge tag 'pull-qapi-2022-12-14-v2' of https://repo.or.cz/qemu/armbru into staging (2022-12-14 22:42:14 +0000)
7
8
Merge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu into staging (2021-12-14 12:46:18 -0800)
9
6
10
are available in the Git repository at:
7
are available in the Git repository at:
11
8
12
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20211215
9
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20221215
13
10
14
for you to fetch changes up to aed176558806674d030a8305d989d4e6a5073359:
11
for you to fetch changes up to 4f3ebdc33618e7c163f769047859d6f34373e3af:
15
12
16
tests/acpi: add expected blob for VIOT test on virt machine (2021-12-15 10:35:26 +0000)
13
target/arm: Restrict arm_cpu_exec_interrupt() to TCG accelerator (2022-12-15 11:18:20 +0000)
17
14
18
----------------------------------------------------------------
15
----------------------------------------------------------------
19
target-arm queue:
16
target-arm queue:
20
* ITS: error reporting cleanup
17
* hw/arm/virt: Add properties to allow more granular
21
* aspeed: improve documentation
18
configuration of use of highmem space
22
* Fix STM32F2XX USART data register readout
19
* target/arm: Add Cortex-A55 CPU
23
* allow emulated GICv3 to be disabled in non-TCG builds
20
* hw/intc/arm_gicv3: Fix GICD_TYPER ITLinesNumber advertisement
24
* fix exception priority for singlestep, misaligned PC, bp, etc
21
* Implement FEAT_EVT
25
* Correct calculation of tlb range invalidate length
22
* Some 3-phase-reset conversions for Arm GIC, SMMU
26
* npcm7xx_emc: fix missing queue_flush
23
* hw/arm/boot: set initrd with #address-cells type in fdt
27
* virt: Add VIOT ACPI table for virtio-iommu
24
* align user-mode exposed ID registers with Linux
28
* target/i386: Use assert() to sanity-check b1 in SSE decode
25
* hw/misc: Move some arm-related files from specific_ss into softmmu_ss
29
* Don't include qemu-common unnecessarily
26
* Restrict arm_cpu_exec_interrupt() to TCG accelerator
30
27
31
----------------------------------------------------------------
28
----------------------------------------------------------------
32
Alex Bennée (1):
29
Gavin Shan (7):
33
hw/intc: clean-up error reporting for failed ITS cmd
30
hw/arm/virt: Introduce virt_set_high_memmap() helper
31
hw/arm/virt: Rename variable size to region_size in virt_set_high_memmap()
32
hw/arm/virt: Introduce variable region_base in virt_set_high_memmap()
33
hw/arm/virt: Introduce virt_get_high_memmap_enabled() helper
34
hw/arm/virt: Improve high memory region address assignment
35
hw/arm/virt: Add 'compact-highmem' property
36
hw/arm/virt: Add properties to disable high memory regions
34
37
35
Jean-Philippe Brucker (8):
38
Luke Starrett (1):
36
hw/arm/virt-acpi-build: Add VIOT table for virtio-iommu
39
hw/intc/arm_gicv3: Fix GICD_TYPER ITLinesNumber advertisement
37
hw/arm/virt: Remove device tree restriction for virtio-iommu
38
hw/arm/virt: Reject instantiation of multiple IOMMUs
39
hw/arm/virt: Use object_property_set instead of qdev_prop_set
40
tests/acpi: allow updates of VIOT expected data files
41
tests/acpi: add test case for VIOT
42
tests/acpi: add expected blobs for VIOT test on q35 machine
43
tests/acpi: add expected blob for VIOT test on virt machine
44
40
45
Joel Stanley (4):
41
Mihai Carabas (1):
46
docs: aspeed: Add new boards
42
hw/arm/virt: build SMBIOS 19 table
47
docs: aspeed: Update OpenBMC image URL
48
docs: aspeed: Give an example of booting a kernel
49
docs: aspeed: ADC is now modelled
50
43
51
Olivier Hériveaux (1):
44
Peter Maydell (15):
52
Fix STM32F2XX USART data register readout
45
target/arm: Allow relevant HCR bits to be written for FEAT_EVT
46
target/arm: Implement HCR_EL2.TTLBIS traps
47
target/arm: Implement HCR_EL2.TTLBOS traps
48
target/arm: Implement HCR_EL2.TICAB,TOCU traps
49
target/arm: Implement HCR_EL2.TID4 traps
50
target/arm: Report FEAT_EVT for TCG '-cpu max'
51
hw/arm: Convert TYPE_ARM_SMMU to 3-phase reset
52
hw/arm: Convert TYPE_ARM_SMMUV3 to 3-phase reset
53
hw/intc: Convert TYPE_ARM_GIC_COMMON to 3-phase reset
54
hw/intc: Convert TYPE_ARM_GIC_KVM to 3-phase reset
55
hw/intc: Convert TYPE_ARM_GICV3_COMMON to 3-phase reset
56
hw/intc: Convert TYPE_KVM_ARM_GICV3 to 3-phase reset
57
hw/intc: Convert TYPE_ARM_GICV3_ITS_COMMON to 3-phase reset
58
hw/intc: Convert TYPE_ARM_GICV3_ITS to 3-phase reset
59
hw/intc: Convert TYPE_KVM_ARM_ITS to 3-phase reset
53
60
54
Patrick Venture (1):
61
Philippe Mathieu-Daudé (1):
55
hw/net: npcm7xx_emc fix missing queue_flush
62
target/arm: Restrict arm_cpu_exec_interrupt() to TCG accelerator
56
63
57
Peter Maydell (6):
64
Schspa Shi (1):
58
target/i386: Use assert() to sanity-check b1 in SSE decode
65
hw/arm/boot: set initrd with #address-cells type in fdt
59
include/hw/i386: Don't include qemu-common.h in .h files
60
target/hexagon/cpu.h: don't include qemu-common.h
61
target/rx/cpu.h: Don't include qemu-common.h
62
hw/arm: Don't include qemu-common.h unnecessarily
63
target/arm: Correct calculation of tlb range invalidate length
64
66
65
Philippe Mathieu-Daudé (2):
67
Thomas Huth (1):
66
hw/intc/arm_gicv3: Extract gicv3_set_gicv3state from arm_gicv3_cpuif.c
68
hw/misc: Move some arm-related files from specific_ss into softmmu_ss
67
hw/intc/arm_gicv3: Introduce CONFIG_ARM_GIC_TCG Kconfig selector
68
69
69
Richard Henderson (10):
70
Timofey Kutergin (1):
70
target/arm: Hoist pc_next to a local variable in aarch64_tr_translate_insn
71
target/arm: Add Cortex-A55 CPU
71
target/arm: Hoist pc_next to a local variable in arm_tr_translate_insn
72
target/arm: Hoist pc_next to a local variable in thumb_tr_translate_insn
73
target/arm: Split arm_pre_translate_insn
74
target/arm: Advance pc for arch single-step exception
75
target/arm: Split compute_fsr_fsc out of arm_deliver_fault
76
target/arm: Take an exception if PC is misaligned
77
target/arm: Assert thumb pc is aligned
78
target/arm: Suppress bp for exceptions with more priority
79
tests/tcg: Add arm and aarch64 pc alignment tests
80
72
81
docs/system/arm/aspeed.rst | 26 ++++++++++++----
73
Zhuojia Shen (1):
82
include/hw/i386/microvm.h | 1 -
74
target/arm: align exposed ID registers with Linux
83
include/hw/i386/x86.h | 1 -
84
target/arm/helper.h | 1 +
85
target/arm/syndrome.h | 5 +++
86
target/hexagon/cpu.h | 1 -
87
target/rx/cpu.h | 1 -
88
hw/arm/boot.c | 1 -
89
hw/arm/digic_boards.c | 1 -
90
hw/arm/highbank.c | 1 -
91
hw/arm/npcm7xx_boards.c | 1 -
92
hw/arm/sbsa-ref.c | 1 -
93
hw/arm/stm32f405_soc.c | 1 -
94
hw/arm/vexpress.c | 1 -
95
hw/arm/virt-acpi-build.c | 7 +++++
96
hw/arm/virt.c | 21 ++++++-------
97
hw/char/stm32f2xx_usart.c | 3 +-
98
hw/intc/arm_gicv3.c | 2 +-
99
hw/intc/arm_gicv3_cpuif.c | 10 +-----
100
hw/intc/arm_gicv3_cpuif_common.c | 22 +++++++++++++
101
hw/intc/arm_gicv3_its.c | 39 +++++++++++++++--------
102
hw/net/npcm7xx_emc.c | 18 +++++------
103
hw/virtio/virtio-iommu-pci.c | 12 ++------
104
linux-user/aarch64/cpu_loop.c | 46 ++++++++++++++++------------
105
linux-user/hexagon/cpu_loop.c | 1 +
106
target/arm/debug_helper.c | 23 ++++++++++++++
107
target/arm/gdbstub.c | 9 ++++--
108
target/arm/helper.c | 6 ++--
109
target/arm/machine.c | 10 ++++++
110
target/arm/tlb_helper.c | 63 ++++++++++++++++++++++++++++----------
111
target/arm/translate-a64.c | 23 ++++++++++++--
112
target/arm/translate.c | 58 ++++++++++++++++++++++++++---------
113
target/i386/tcg/translate.c | 12 ++------
114
tests/qtest/bios-tables-test.c | 38 +++++++++++++++++++++++
115
tests/tcg/aarch64/pcalign-a64.c | 37 ++++++++++++++++++++++
116
tests/tcg/arm/pcalign-a32.c | 46 ++++++++++++++++++++++++++++
117
hw/arm/Kconfig | 1 +
118
hw/intc/Kconfig | 5 +++
119
hw/intc/meson.build | 11 ++++---
120
tests/data/acpi/q35/DSDT.viot | Bin 0 -> 9398 bytes
121
tests/data/acpi/q35/VIOT.viot | Bin 0 -> 112 bytes
122
tests/data/acpi/virt/VIOT | Bin 0 -> 88 bytes
123
tests/tcg/aarch64/Makefile.target | 4 +--
124
tests/tcg/arm/Makefile.target | 4 +++
125
44 files changed, 429 insertions(+), 145 deletions(-)
126
create mode 100644 hw/intc/arm_gicv3_cpuif_common.c
127
create mode 100644 tests/tcg/aarch64/pcalign-a64.c
128
create mode 100644 tests/tcg/arm/pcalign-a32.c
129
create mode 100644 tests/data/acpi/q35/DSDT.viot
130
create mode 100644 tests/data/acpi/q35/VIOT.viot
131
create mode 100644 tests/data/acpi/virt/VIOT
132
75
76
docs/system/arm/emulation.rst | 1 +
77
docs/system/arm/virt.rst | 18 +++
78
include/hw/arm/smmuv3.h | 2 +-
79
include/hw/arm/virt.h | 2 +
80
include/hw/misc/xlnx-zynqmp-apu-ctrl.h | 2 +-
81
target/arm/cpu.h | 30 +++++
82
target/arm/kvm-consts.h | 8 +-
83
hw/arm/boot.c | 10 +-
84
hw/arm/smmu-common.c | 7 +-
85
hw/arm/smmuv3.c | 12 +-
86
hw/arm/virt.c | 202 +++++++++++++++++++++++-----
87
hw/intc/arm_gic_common.c | 7 +-
88
hw/intc/arm_gic_kvm.c | 14 +-
89
hw/intc/arm_gicv3_common.c | 7 +-
90
hw/intc/arm_gicv3_dist.c | 4 +-
91
hw/intc/arm_gicv3_its.c | 14 +-
92
hw/intc/arm_gicv3_its_common.c | 7 +-
93
hw/intc/arm_gicv3_its_kvm.c | 14 +-
94
hw/intc/arm_gicv3_kvm.c | 14 +-
95
hw/misc/imx6_src.c | 2 +-
96
hw/misc/iotkit-sysctl.c | 1 -
97
target/arm/cpu.c | 5 +-
98
target/arm/cpu64.c | 70 ++++++++++
99
target/arm/cpu_tcg.c | 1 +
100
target/arm/helper.c | 231 ++++++++++++++++++++++++---------
101
hw/misc/meson.build | 11 +-
102
26 files changed, 538 insertions(+), 158 deletions(-)
103
diff view generated by jsdifflib
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
1
From: Gavin Shan <gshan@redhat.com>
2
2
3
We do not support instantiating multiple IOMMUs. Before adding a
3
This introduces virt_set_high_memmap() helper. The logic of high
4
virtio-iommu, check that no other IOMMU is present. This will detect
4
memory region address assignment is moved to the helper. The intention
5
both "iommu=smmuv3" machine parameter and another virtio-iommu instance.
5
is to make the subsequent optimization for high memory region address
6
assignment easier.
6
7
7
Fixes: 70e89132c9 ("hw/arm/virt: Add the virtio-iommu device tree mappings")
8
No functional change intended.
9
10
Signed-off-by: Gavin Shan <gshan@redhat.com>
8
Reviewed-by: Eric Auger <eric.auger@redhat.com>
11
Reviewed-by: Eric Auger <eric.auger@redhat.com>
9
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
12
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
10
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
13
Reviewed-by: Marc Zyngier <maz@kernel.org>
11
Message-id: 20211210170415.583179-4-jean-philippe@linaro.org
14
Tested-by: Zhenyu Zhang <zhenyzha@redhat.com>
15
Message-id: 20221029224307.138822-2-gshan@redhat.com
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
17
---
14
hw/arm/virt.c | 5 +++++
18
hw/arm/virt.c | 74 ++++++++++++++++++++++++++++-----------------------
15
1 file changed, 5 insertions(+)
19
1 file changed, 41 insertions(+), 33 deletions(-)
16
20
17
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
21
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
18
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/virt.c
23
--- a/hw/arm/virt.c
20
+++ b/hw/arm/virt.c
24
+++ b/hw/arm/virt.c
21
@@ -XXX,XX +XXX,XX @@ static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev,
25
@@ -XXX,XX +XXX,XX @@ static uint64_t virt_cpu_mp_affinity(VirtMachineState *vms, int idx)
22
hwaddr db_start = 0, db_end = 0;
26
return arm_cpu_mp_affinity(idx, clustersz);
23
char *resv_prop_str;
27
}
24
28
25
+ if (vms->iommu != VIRT_IOMMU_NONE) {
29
+static void virt_set_high_memmap(VirtMachineState *vms,
26
+ error_setg(errp, "virt machine does not support multiple IOMMUs");
30
+ hwaddr base, int pa_bits)
27
+ return;
31
+{
32
+ int i;
33
+
34
+ for (i = VIRT_LOWMEMMAP_LAST; i < ARRAY_SIZE(extended_memmap); i++) {
35
+ hwaddr size = extended_memmap[i].size;
36
+ bool fits;
37
+
38
+ base = ROUND_UP(base, size);
39
+ vms->memmap[i].base = base;
40
+ vms->memmap[i].size = size;
41
+
42
+ /*
43
+ * Check each device to see if they fit in the PA space,
44
+ * moving highest_gpa as we go.
45
+ *
46
+ * For each device that doesn't fit, disable it.
47
+ */
48
+ fits = (base + size) <= BIT_ULL(pa_bits);
49
+ if (fits) {
50
+ vms->highest_gpa = base + size - 1;
28
+ }
51
+ }
29
+
52
+
30
switch (vms->msi_controller) {
53
+ switch (i) {
31
case VIRT_MSI_CTRL_NONE:
54
+ case VIRT_HIGH_GIC_REDIST2:
32
return;
55
+ vms->highmem_redists &= fits;
56
+ break;
57
+ case VIRT_HIGH_PCIE_ECAM:
58
+ vms->highmem_ecam &= fits;
59
+ break;
60
+ case VIRT_HIGH_PCIE_MMIO:
61
+ vms->highmem_mmio &= fits;
62
+ break;
63
+ }
64
+
65
+ base += size;
66
+ }
67
+}
68
+
69
static void virt_set_memmap(VirtMachineState *vms, int pa_bits)
70
{
71
MachineState *ms = MACHINE(vms);
72
@@ -XXX,XX +XXX,XX @@ static void virt_set_memmap(VirtMachineState *vms, int pa_bits)
73
/* We know for sure that at least the memory fits in the PA space */
74
vms->highest_gpa = memtop - 1;
75
76
- for (i = VIRT_LOWMEMMAP_LAST; i < ARRAY_SIZE(extended_memmap); i++) {
77
- hwaddr size = extended_memmap[i].size;
78
- bool fits;
79
-
80
- base = ROUND_UP(base, size);
81
- vms->memmap[i].base = base;
82
- vms->memmap[i].size = size;
83
-
84
- /*
85
- * Check each device to see if they fit in the PA space,
86
- * moving highest_gpa as we go.
87
- *
88
- * For each device that doesn't fit, disable it.
89
- */
90
- fits = (base + size) <= BIT_ULL(pa_bits);
91
- if (fits) {
92
- vms->highest_gpa = base + size - 1;
93
- }
94
-
95
- switch (i) {
96
- case VIRT_HIGH_GIC_REDIST2:
97
- vms->highmem_redists &= fits;
98
- break;
99
- case VIRT_HIGH_PCIE_ECAM:
100
- vms->highmem_ecam &= fits;
101
- break;
102
- case VIRT_HIGH_PCIE_MMIO:
103
- vms->highmem_mmio &= fits;
104
- break;
105
- }
106
-
107
- base += size;
108
- }
109
+ virt_set_high_memmap(vms, base, pa_bits);
110
111
if (device_memory_size > 0) {
112
ms->device_memory = g_malloc0(sizeof(*ms->device_memory));
33
--
113
--
34
2.25.1
114
2.25.1
35
36
diff view generated by jsdifflib
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
1
From: Gavin Shan <gshan@redhat.com>
2
2
3
The VIOT blob contains the following:
3
This renames variable 'size' to 'region_size' in virt_set_high_memmap().
4
Its counterpart ('region_base') will be introduced in next patch.
4
5
5
[000h 0000 4] Signature : "VIOT" [Virtual I/O Translation Table]
6
No functional change intended.
6
[004h 0004 4] Table Length : 00000058
7
[008h 0008 1] Revision : 00
8
[009h 0009 1] Checksum : 66
9
[00Ah 0010 6] Oem ID : "BOCHS "
10
[010h 0016 8] Oem Table ID : "BXPC "
11
[018h 0024 4] Oem Revision : 00000001
12
[01Ch 0028 4] Asl Compiler ID : "BXPC"
13
[020h 0032 4] Asl Compiler Revision : 00000001
14
7
15
[024h 0036 2] Node count : 0002
8
Signed-off-by: Gavin Shan <gshan@redhat.com>
16
[026h 0038 2] Node offset : 0030
17
[028h 0040 8] Reserved : 0000000000000000
18
19
[030h 0048 1] Type : 03 [VirtIO-PCI IOMMU]
20
[031h 0049 1] Reserved : 00
21
[032h 0050 2] Length : 0010
22
23
[034h 0052 2] PCI Segment : 0000
24
[036h 0054 2] PCI BDF number : 0008
25
[038h 0056 8] Reserved : 0000000000000000
26
27
[040h 0064 1] Type : 01 [PCI Range]
28
[041h 0065 1] Reserved : 00
29
[042h 0066 2] Length : 0018
30
31
[044h 0068 4] Endpoint start : 00000000
32
[048h 0072 2] PCI Segment start : 0000
33
[04Ah 0074 2] PCI Segment end : 0000
34
[04Ch 0076 2] PCI BDF start : 0000
35
[04Eh 0078 2] PCI BDF end : 00FF
36
[050h 0080 2] Output node : 0030
37
[052h 0082 6] Reserved : 000000000000
38
39
Acked-by: Ani Sinha <ani@anisinha.ca>
40
Reviewed-by: Eric Auger <eric.auger@redhat.com>
9
Reviewed-by: Eric Auger <eric.auger@redhat.com>
41
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
10
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
42
Message-id: 20211210170415.583179-9-jean-philippe@linaro.org
11
Reviewed-by: Marc Zyngier <maz@kernel.org>
12
Tested-by: Zhenyu Zhang <zhenyzha@redhat.com>
13
Message-id: 20221029224307.138822-3-gshan@redhat.com
43
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
44
---
15
---
45
tests/qtest/bios-tables-test-allowed-diff.h | 1 -
16
hw/arm/virt.c | 15 ++++++++-------
46
tests/data/acpi/virt/VIOT | Bin 0 -> 88 bytes
17
1 file changed, 8 insertions(+), 7 deletions(-)
47
2 files changed, 1 deletion(-)
48
18
49
diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
19
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
50
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
51
--- a/tests/qtest/bios-tables-test-allowed-diff.h
21
--- a/hw/arm/virt.c
52
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
22
+++ b/hw/arm/virt.c
53
@@ -1,2 +1 @@
23
@@ -XXX,XX +XXX,XX @@ static uint64_t virt_cpu_mp_affinity(VirtMachineState *vms, int idx)
54
/* List of comma-separated changed AML files to ignore */
24
static void virt_set_high_memmap(VirtMachineState *vms,
55
-"tests/data/acpi/virt/VIOT",
25
hwaddr base, int pa_bits)
56
diff --git a/tests/data/acpi/virt/VIOT b/tests/data/acpi/virt/VIOT
26
{
57
index XXXXXXX..XXXXXXX 100644
27
+ hwaddr region_size;
58
GIT binary patch
28
+ bool fits;
59
literal 88
29
int i;
60
zcmWIZ^bd((0D?3pe`k+i1*eDrX9XZ&1PX!JAexE60Hgv8m>C3sGzXN&z`)2L0cSHX
30
61
I{D-Rq0Q5fy0RR91
31
for (i = VIRT_LOWMEMMAP_LAST; i < ARRAY_SIZE(extended_memmap); i++) {
62
32
- hwaddr size = extended_memmap[i].size;
63
literal 0
33
- bool fits;
64
HcmV?d00001
34
+ region_size = extended_memmap[i].size;
65
35
36
- base = ROUND_UP(base, size);
37
+ base = ROUND_UP(base, region_size);
38
vms->memmap[i].base = base;
39
- vms->memmap[i].size = size;
40
+ vms->memmap[i].size = region_size;
41
42
/*
43
* Check each device to see if they fit in the PA space,
44
@@ -XXX,XX +XXX,XX @@ static void virt_set_high_memmap(VirtMachineState *vms,
45
*
46
* For each device that doesn't fit, disable it.
47
*/
48
- fits = (base + size) <= BIT_ULL(pa_bits);
49
+ fits = (base + region_size) <= BIT_ULL(pa_bits);
50
if (fits) {
51
- vms->highest_gpa = base + size - 1;
52
+ vms->highest_gpa = base + region_size - 1;
53
}
54
55
switch (i) {
56
@@ -XXX,XX +XXX,XX @@ static void virt_set_high_memmap(VirtMachineState *vms,
57
break;
58
}
59
60
- base += size;
61
+ base += region_size;
62
}
63
}
64
66
--
65
--
67
2.25.1
66
2.25.1
68
69
diff view generated by jsdifflib
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
1
From: Gavin Shan <gshan@redhat.com>
2
2
3
virtio-iommu is now supported with ACPI VIOT as well as device tree.
3
This introduces variable 'region_base' for the base address of the
4
Remove the restriction that prevents from instantiating a virtio-iommu
4
specific high memory region. It's the preparatory work to optimize
5
device under ACPI.
5
high memory region address assignment.
6
6
7
Acked-by: Igor Mammedov <imammedo@redhat.com>
7
No functional change intended.
8
9
Signed-off-by: Gavin Shan <gshan@redhat.com>
8
Reviewed-by: Eric Auger <eric.auger@redhat.com>
10
Reviewed-by: Eric Auger <eric.auger@redhat.com>
9
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
11
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
10
Message-id: 20211210170415.583179-3-jean-philippe@linaro.org
12
Reviewed-by: Marc Zyngier <maz@kernel.org>
13
Tested-by: Zhenyu Zhang <zhenyzha@redhat.com>
14
Message-id: 20221029224307.138822-4-gshan@redhat.com
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
16
---
13
hw/arm/virt.c | 10 ++--------
17
hw/arm/virt.c | 12 ++++++------
14
hw/virtio/virtio-iommu-pci.c | 12 ++----------
18
1 file changed, 6 insertions(+), 6 deletions(-)
15
2 files changed, 4 insertions(+), 18 deletions(-)
16
19
17
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
20
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
18
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/virt.c
22
--- a/hw/arm/virt.c
20
+++ b/hw/arm/virt.c
23
+++ b/hw/arm/virt.c
21
@@ -XXX,XX +XXX,XX @@ static HotplugHandler *virt_machine_get_hotplug_handler(MachineState *machine,
24
@@ -XXX,XX +XXX,XX @@ static uint64_t virt_cpu_mp_affinity(VirtMachineState *vms, int idx)
22
MachineClass *mc = MACHINE_GET_CLASS(machine);
25
static void virt_set_high_memmap(VirtMachineState *vms,
23
26
hwaddr base, int pa_bits)
24
if (device_is_dynamic_sysbus(mc, dev) ||
27
{
25
- (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM))) {
28
- hwaddr region_size;
26
+ object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM) ||
29
+ hwaddr region_base, region_size;
27
+ object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) {
30
bool fits;
28
return HOTPLUG_HANDLER(machine);
31
int i;
32
33
for (i = VIRT_LOWMEMMAP_LAST; i < ARRAY_SIZE(extended_memmap); i++) {
34
+ region_base = ROUND_UP(base, extended_memmap[i].size);
35
region_size = extended_memmap[i].size;
36
37
- base = ROUND_UP(base, region_size);
38
- vms->memmap[i].base = base;
39
+ vms->memmap[i].base = region_base;
40
vms->memmap[i].size = region_size;
41
42
/*
43
@@ -XXX,XX +XXX,XX @@ static void virt_set_high_memmap(VirtMachineState *vms,
44
*
45
* For each device that doesn't fit, disable it.
46
*/
47
- fits = (base + region_size) <= BIT_ULL(pa_bits);
48
+ fits = (region_base + region_size) <= BIT_ULL(pa_bits);
49
if (fits) {
50
- vms->highest_gpa = base + region_size - 1;
51
+ vms->highest_gpa = region_base + region_size - 1;
52
}
53
54
switch (i) {
55
@@ -XXX,XX +XXX,XX @@ static void virt_set_high_memmap(VirtMachineState *vms,
56
break;
57
}
58
59
- base += region_size;
60
+ base = region_base + region_size;
29
}
61
}
30
- if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) {
31
- VirtMachineState *vms = VIRT_MACHINE(machine);
32
-
33
- if (!vms->bootinfo.firmware_loaded || !virt_is_acpi_enabled(vms)) {
34
- return HOTPLUG_HANDLER(machine);
35
- }
36
- }
37
return NULL;
38
}
62
}
39
63
40
diff --git a/hw/virtio/virtio-iommu-pci.c b/hw/virtio/virtio-iommu-pci.c
41
index XXXXXXX..XXXXXXX 100644
42
--- a/hw/virtio/virtio-iommu-pci.c
43
+++ b/hw/virtio/virtio-iommu-pci.c
44
@@ -XXX,XX +XXX,XX @@ static void virtio_iommu_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
45
VirtIOIOMMU *s = VIRTIO_IOMMU(vdev);
46
47
if (!qdev_get_machine_hotplug_handler(DEVICE(vpci_dev))) {
48
- MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine());
49
-
50
- error_setg(errp,
51
- "%s machine fails to create iommu-map device tree bindings",
52
- mc->name);
53
- error_append_hint(errp,
54
- "Check your machine implements a hotplug handler "
55
- "for the virtio-iommu-pci device\n");
56
- error_append_hint(errp, "Check the guest is booted without FW or with "
57
- "-no-acpi\n");
58
+ error_setg(errp, "Check your machine implements a hotplug handler "
59
+ "for the virtio-iommu-pci device");
60
return;
61
}
62
for (int i = 0; i < s->nb_reserved_regions; i++) {
63
--
64
--
64
2.25.1
65
2.25.1
65
66
diff view generated by jsdifflib
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
1
From: Gavin Shan <gshan@redhat.com>
2
2
3
To propagate errors to the caller of the pre_plug callback, use the
3
This introduces virt_get_high_memmap_enabled() helper, which returns
4
object_poperty_set*() functions directly instead of the qdev_prop_set*()
4
the pointer to vms->highmem_{redists, ecam, mmio}. The pointer will
5
helpers.
5
be used in the subsequent patches.
6
6
7
Suggested-by: Igor Mammedov <imammedo@redhat.com>
7
No functional change intended.
8
9
Signed-off-by: Gavin Shan <gshan@redhat.com>
8
Reviewed-by: Eric Auger <eric.auger@redhat.com>
10
Reviewed-by: Eric Auger <eric.auger@redhat.com>
9
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
11
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
10
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
12
Reviewed-by: Marc Zyngier <maz@kernel.org>
11
Message-id: 20211210170415.583179-5-jean-philippe@linaro.org
13
Tested-by: Zhenyu Zhang <zhenyzha@redhat.com>
14
Message-id: 20221029224307.138822-5-gshan@redhat.com
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
16
---
14
hw/arm/virt.c | 5 +++--
17
hw/arm/virt.c | 32 +++++++++++++++++++-------------
15
1 file changed, 3 insertions(+), 2 deletions(-)
18
1 file changed, 19 insertions(+), 13 deletions(-)
16
19
17
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
20
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
18
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/virt.c
22
--- a/hw/arm/virt.c
20
+++ b/hw/arm/virt.c
23
+++ b/hw/arm/virt.c
21
@@ -XXX,XX +XXX,XX @@ static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev,
24
@@ -XXX,XX +XXX,XX @@ static uint64_t virt_cpu_mp_affinity(VirtMachineState *vms, int idx)
22
db_start, db_end,
25
return arm_cpu_mp_affinity(idx, clustersz);
23
VIRTIO_IOMMU_RESV_MEM_T_MSI);
26
}
24
27
25
- qdev_prop_set_uint32(dev, "len-reserved-regions", 1);
28
+static inline bool *virt_get_high_memmap_enabled(VirtMachineState *vms,
26
- qdev_prop_set_string(dev, "reserved-regions[0]", resv_prop_str);
29
+ int index)
27
+ object_property_set_uint(OBJECT(dev), "len-reserved-regions", 1, errp);
30
+{
28
+ object_property_set_str(OBJECT(dev), "reserved-regions[0]",
31
+ bool *enabled_array[] = {
29
+ resv_prop_str, errp);
32
+ &vms->highmem_redists,
30
g_free(resv_prop_str);
33
+ &vms->highmem_ecam,
34
+ &vms->highmem_mmio,
35
+ };
36
+
37
+ assert(ARRAY_SIZE(extended_memmap) - VIRT_LOWMEMMAP_LAST ==
38
+ ARRAY_SIZE(enabled_array));
39
+ assert(index - VIRT_LOWMEMMAP_LAST < ARRAY_SIZE(enabled_array));
40
+
41
+ return enabled_array[index - VIRT_LOWMEMMAP_LAST];
42
+}
43
+
44
static void virt_set_high_memmap(VirtMachineState *vms,
45
hwaddr base, int pa_bits)
46
{
47
hwaddr region_base, region_size;
48
- bool fits;
49
+ bool *region_enabled, fits;
50
int i;
51
52
for (i = VIRT_LOWMEMMAP_LAST; i < ARRAY_SIZE(extended_memmap); i++) {
53
+ region_enabled = virt_get_high_memmap_enabled(vms, i);
54
region_base = ROUND_UP(base, extended_memmap[i].size);
55
region_size = extended_memmap[i].size;
56
57
@@ -XXX,XX +XXX,XX @@ static void virt_set_high_memmap(VirtMachineState *vms,
58
vms->highest_gpa = region_base + region_size - 1;
59
}
60
61
- switch (i) {
62
- case VIRT_HIGH_GIC_REDIST2:
63
- vms->highmem_redists &= fits;
64
- break;
65
- case VIRT_HIGH_PCIE_ECAM:
66
- vms->highmem_ecam &= fits;
67
- break;
68
- case VIRT_HIGH_PCIE_MMIO:
69
- vms->highmem_mmio &= fits;
70
- break;
71
- }
72
-
73
+ *region_enabled &= fits;
74
base = region_base + region_size;
31
}
75
}
32
}
76
}
33
--
77
--
34
2.25.1
78
2.25.1
35
36
diff view generated by jsdifflib
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
1
From: Gavin Shan <gshan@redhat.com>
2
2
3
Add expected blobs of the VIOT and DSDT table for the VIOT test on the
3
There are three high memory regions, which are VIRT_HIGH_REDIST2,
4
q35 machine.
4
VIRT_HIGH_PCIE_ECAM and VIRT_HIGH_PCIE_MMIO. Their base addresses
5
are floating on highest RAM address. However, they can be disabled
6
in several cases.
5
7
6
Since the test instantiates a virtio device and two PCIe expander
8
(1) One specific high memory region is likely to be disabled by
7
bridges, DSDT.viot has more blocks than the base DSDT.
9
code by toggling vms->highmem_{redists, ecam, mmio}.
8
10
9
The VIOT table generated for the q35 test is:
11
(2) VIRT_HIGH_PCIE_ECAM region is disabled on machine, which is
12
'virt-2.12' or ealier than it.
10
13
11
[000h 0000 4] Signature : "VIOT" [Virtual I/O Translation Table]
14
(3) VIRT_HIGH_PCIE_ECAM region is disabled when firmware is loaded
12
[004h 0004 4] Table Length : 00000070
15
on 32-bits system.
13
[008h 0008 1] Revision : 00
14
[009h 0009 1] Checksum : 3D
15
[00Ah 0010 6] Oem ID : "BOCHS "
16
[010h 0016 8] Oem Table ID : "BXPC "
17
[018h 0024 4] Oem Revision : 00000001
18
[01Ch 0028 4] Asl Compiler ID : "BXPC"
19
[020h 0032 4] Asl Compiler Revision : 00000001
20
16
21
[024h 0036 2] Node count : 0003
17
(4) One specific high memory region is disabled when it breaks the
22
[026h 0038 2] Node offset : 0030
18
PA space limit.
23
[028h 0040 8] Reserved : 0000000000000000
24
19
25
[030h 0048 1] Type : 03 [VirtIO-PCI IOMMU]
20
The current implementation of virt_set_{memmap, high_memmap}() isn't
26
[031h 0049 1] Reserved : 00
21
optimized because the high memory region's PA space is always reserved,
27
[032h 0050 2] Length : 0010
22
regardless of whatever the actual state in the corresponding
23
vms->highmem_{redists, ecam, mmio} flag. In the code, 'base' and
24
'vms->highest_gpa' are always increased for case (1), (2) and (3).
25
It's unnecessary since the assigned PA space for the disabled high
26
memory region won't be used afterwards.
28
27
29
[034h 0052 2] PCI Segment : 0000
28
Improve the address assignment for those three high memory region by
30
[036h 0054 2] PCI BDF number : 0010
29
skipping the address assignment for one specific high memory region if
31
[038h 0056 8] Reserved : 0000000000000000
30
it has been disabled in case (1), (2) and (3). The memory layout may
31
be changed after the improvement is applied, which leads to potential
32
migration breakage. So 'vms->highmem_compact' is added to control if
33
the improvement should be applied. For now, 'vms->highmem_compact' is
34
set to false, meaning that we don't have memory layout change until it
35
becomes configurable through property 'compact-highmem' in next patch.
32
36
33
[040h 0064 1] Type : 01 [PCI Range]
37
Signed-off-by: Gavin Shan <gshan@redhat.com>
34
[041h 0065 1] Reserved : 00
35
[042h 0066 2] Length : 0018
36
37
[044h 0068 4] Endpoint start : 00003000
38
[048h 0072 2] PCI Segment start : 0000
39
[04Ah 0074 2] PCI Segment end : 0000
40
[04Ch 0076 2] PCI BDF start : 3000
41
[04Eh 0078 2] PCI BDF end : 30FF
42
[050h 0080 2] Output node : 0030
43
[052h 0082 6] Reserved : 000000000000
44
45
[058h 0088 1] Type : 01 [PCI Range]
46
[059h 0089 1] Reserved : 00
47
[05Ah 0090 2] Length : 0018
48
49
[05Ch 0092 4] Endpoint start : 00001000
50
[060h 0096 2] PCI Segment start : 0000
51
[062h 0098 2] PCI Segment end : 0000
52
[064h 0100 2] PCI BDF start : 1000
53
[066h 0102 2] PCI BDF end : 10FF
54
[068h 0104 2] Output node : 0030
55
[06Ah 0106 6] Reserved : 000000000000
56
57
And the DSDT diff is:
58
59
@@ -XXX,XX +XXX,XX @@
60
*
61
* Disassembling to symbolic ASL+ operators
62
*
63
- * Disassembly of tests/data/acpi/q35/DSDT, Fri Dec 10 15:03:08 2021
64
+ * Disassembly of /tmp/aml-H9Y5D1, Fri Dec 10 15:02:27 2021
65
*
66
* Original Table Header:
67
* Signature "DSDT"
68
- * Length 0x00002061 (8289)
69
+ * Length 0x000024B6 (9398)
70
* Revision 0x01 **** 32-bit table (V1), no 64-bit math support
71
- * Checksum 0xFA
72
+ * Checksum 0xA7
73
* OEM ID "BOCHS "
74
* OEM Table ID "BXPC "
75
* OEM Revision 0x00000001 (1)
76
@@ -XXX,XX +XXX,XX @@
77
}
78
}
79
80
+ Scope (\_SB)
81
+ {
82
+ Device (PC30)
83
+ {
84
+ Name (_UID, 0x30) // _UID: Unique ID
85
+ Name (_BBN, 0x30) // _BBN: BIOS Bus Number
86
+ Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */) // _HID: Hardware ID
87
+ Name (_CID, EisaId ("PNP0A03") /* PCI Bus */) // _CID: Compatible ID
88
+ Method (_OSC, 4, NotSerialized) // _OSC: Operating System Capabilities
89
+ {
90
+ CreateDWordField (Arg3, Zero, CDW1)
91
+ If ((Arg0 == ToUUID ("33db4d5b-1ff7-401c-9657-7441c03dd766") /* PCI Host Bridge Device */))
92
+ {
93
+ CreateDWordField (Arg3, 0x04, CDW2)
94
+ CreateDWordField (Arg3, 0x08, CDW3)
95
+ Local0 = CDW3 /* \_SB_.PC30._OSC.CDW3 */
96
+ Local0 &= 0x1F
97
+ If ((Arg1 != One))
98
+ {
99
+ CDW1 |= 0x08
100
+ }
101
+
102
+ If ((CDW3 != Local0))
103
+ {
104
+ CDW1 |= 0x10
105
+ }
106
+
107
+ CDW3 = Local0
108
+ }
109
+ Else
110
+ {
111
+ CDW1 |= 0x04
112
+ }
113
+
114
+ Return (Arg3)
115
+ }
116
+
117
+ Method (_PRT, 0, NotSerialized) // _PRT: PCI Routing Table
118
+ {
119
+ Local0 = Package (0x80){}
120
+ Local1 = Zero
121
+ While ((Local1 < 0x80))
122
+ {
123
+ Local2 = (Local1 >> 0x02)
124
+ Local3 = ((Local1 + Local2) & 0x03)
125
+ If ((Local3 == Zero))
126
+ {
127
+ Local4 = Package (0x04)
128
+ {
129
+ Zero,
130
+ Zero,
131
+ LNKD,
132
+ Zero
133
+ }
134
+ }
135
+
136
+ If ((Local3 == One))
137
+ {
138
+ Local4 = Package (0x04)
139
+ {
140
+ Zero,
141
+ Zero,
142
+ LNKA,
143
+ Zero
144
+ }
145
+ }
146
+
147
+ If ((Local3 == 0x02))
148
+ {
149
+ Local4 = Package (0x04)
150
+ {
151
+ Zero,
152
+ Zero,
153
+ LNKB,
154
+ Zero
155
+ }
156
+ }
157
+
158
+ If ((Local3 == 0x03))
159
+ {
160
+ Local4 = Package (0x04)
161
+ {
162
+ Zero,
163
+ Zero,
164
+ LNKC,
165
+ Zero
166
+ }
167
+ }
168
+
169
+ Local4 [Zero] = ((Local2 << 0x10) | 0xFFFF)
170
+ Local4 [One] = (Local1 & 0x03)
171
+ Local0 [Local1] = Local4
172
+ Local1++
173
+ }
174
+
175
+ Return (Local0)
176
+ }
177
+
178
+ Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings
179
+ {
180
+ WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
181
+ 0x0000, // Granularity
182
+ 0x0030, // Range Minimum
183
+ 0x0030, // Range Maximum
184
+ 0x0000, // Translation Offset
185
+ 0x0001, // Length
186
+ ,, )
187
+ })
188
+ }
189
+ }
190
+
191
+ Scope (\_SB)
192
+ {
193
+ Device (PC20)
194
+ {
195
+ Name (_UID, 0x20) // _UID: Unique ID
196
+ Name (_BBN, 0x20) // _BBN: BIOS Bus Number
197
+ Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */) // _HID: Hardware ID
198
+ Name (_CID, EisaId ("PNP0A03") /* PCI Bus */) // _CID: Compatible ID
199
+ Method (_OSC, 4, NotSerialized) // _OSC: Operating System Capabilities
200
+ {
201
+ CreateDWordField (Arg3, Zero, CDW1)
202
+ If ((Arg0 == ToUUID ("33db4d5b-1ff7-401c-9657-7441c03dd766") /* PCI Host Bridge Device */))
203
+ {
204
+ CreateDWordField (Arg3, 0x04, CDW2)
205
+ CreateDWordField (Arg3, 0x08, CDW3)
206
+ Local0 = CDW3 /* \_SB_.PC20._OSC.CDW3 */
207
+ Local0 &= 0x1F
208
+ If ((Arg1 != One))
209
+ {
210
+ CDW1 |= 0x08
211
+ }
212
+
213
+ If ((CDW3 != Local0))
214
+ {
215
+ CDW1 |= 0x10
216
+ }
217
+
218
+ CDW3 = Local0
219
+ }
220
+ Else
221
+ {
222
+ CDW1 |= 0x04
223
+ }
224
+
225
+ Return (Arg3)
226
+ }
227
+
228
+ Method (_PRT, 0, NotSerialized) // _PRT: PCI Routing Table
229
+ {
230
+ Local0 = Package (0x80){}
231
+ Local1 = Zero
232
+ While ((Local1 < 0x80))
233
+ {
234
+ Local2 = (Local1 >> 0x02)
235
+ Local3 = ((Local1 + Local2) & 0x03)
236
+ If ((Local3 == Zero))
237
+ {
238
+ Local4 = Package (0x04)
239
+ {
240
+ Zero,
241
+ Zero,
242
+ LNKD,
243
+ Zero
244
+ }
245
+ }
246
+
247
+ If ((Local3 == One))
248
+ {
249
+ Local4 = Package (0x04)
250
+ {
251
+ Zero,
252
+ Zero,
253
+ LNKA,
254
+ Zero
255
+ }
256
+ }
257
+
258
+ If ((Local3 == 0x02))
259
+ {
260
+ Local4 = Package (0x04)
261
+ {
262
+ Zero,
263
+ Zero,
264
+ LNKB,
265
+ Zero
266
+ }
267
+ }
268
+
269
+ If ((Local3 == 0x03))
270
+ {
271
+ Local4 = Package (0x04)
272
+ {
273
+ Zero,
274
+ Zero,
275
+ LNKC,
276
+ Zero
277
+ }
278
+ }
279
+
280
+ Local4 [Zero] = ((Local2 << 0x10) | 0xFFFF)
281
+ Local4 [One] = (Local1 & 0x03)
282
+ Local0 [Local1] = Local4
283
+ Local1++
284
+ }
285
+
286
+ Return (Local0)
287
+ }
288
+
289
+ Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings
290
+ {
291
+ WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
292
+ 0x0000, // Granularity
293
+ 0x0020, // Range Minimum
294
+ 0x0020, // Range Maximum
295
+ 0x0000, // Translation Offset
296
+ 0x0001, // Length
297
+ ,, )
298
+ })
299
+ }
300
+ }
301
+
302
+ Scope (\_SB)
303
+ {
304
+ Device (PC10)
305
+ {
306
+ Name (_UID, 0x10) // _UID: Unique ID
307
+ Name (_BBN, 0x10) // _BBN: BIOS Bus Number
308
+ Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */) // _HID: Hardware ID
309
+ Name (_CID, EisaId ("PNP0A03") /* PCI Bus */) // _CID: Compatible ID
310
+ Method (_OSC, 4, NotSerialized) // _OSC: Operating System Capabilities
311
+ {
312
+ CreateDWordField (Arg3, Zero, CDW1)
313
+ If ((Arg0 == ToUUID ("33db4d5b-1ff7-401c-9657-7441c03dd766") /* PCI Host Bridge Device */))
314
+ {
315
+ CreateDWordField (Arg3, 0x04, CDW2)
316
+ CreateDWordField (Arg3, 0x08, CDW3)
317
+ Local0 = CDW3 /* \_SB_.PC10._OSC.CDW3 */
318
+ Local0 &= 0x1F
319
+ If ((Arg1 != One))
320
+ {
321
+ CDW1 |= 0x08
322
+ }
323
+
324
+ If ((CDW3 != Local0))
325
+ {
326
+ CDW1 |= 0x10
327
+ }
328
+
329
+ CDW3 = Local0
330
+ }
331
+ Else
332
+ {
333
+ CDW1 |= 0x04
334
+ }
335
+
336
+ Return (Arg3)
337
+ }
338
+
339
+ Method (_PRT, 0, NotSerialized) // _PRT: PCI Routing Table
340
+ {
341
+ Local0 = Package (0x80){}
342
+ Local1 = Zero
343
+ While ((Local1 < 0x80))
344
+ {
345
+ Local2 = (Local1 >> 0x02)
346
+ Local3 = ((Local1 + Local2) & 0x03)
347
+ If ((Local3 == Zero))
348
+ {
349
+ Local4 = Package (0x04)
350
+ {
351
+ Zero,
352
+ Zero,
353
+ LNKD,
354
+ Zero
355
+ }
356
+ }
357
+
358
+ If ((Local3 == One))
359
+ {
360
+ Local4 = Package (0x04)
361
+ {
362
+ Zero,
363
+ Zero,
364
+ LNKA,
365
+ Zero
366
+ }
367
+ }
368
+
369
+ If ((Local3 == 0x02))
370
+ {
371
+ Local4 = Package (0x04)
372
+ {
373
+ Zero,
374
+ Zero,
375
+ LNKB,
376
+ Zero
377
+ }
378
+ }
379
+
380
+ If ((Local3 == 0x03))
381
+ {
382
+ Local4 = Package (0x04)
383
+ {
384
+ Zero,
385
+ Zero,
386
+ LNKC,
387
+ Zero
388
+ }
389
+ }
390
+
391
+ Local4 [Zero] = ((Local2 << 0x10) | 0xFFFF)
392
+ Local4 [One] = (Local1 & 0x03)
393
+ Local0 [Local1] = Local4
394
+ Local1++
395
+ }
396
+
397
+ Return (Local0)
398
+ }
399
+
400
+ Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings
401
+ {
402
+ WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
403
+ 0x0000, // Granularity
404
+ 0x0010, // Range Minimum
405
+ 0x0010, // Range Maximum
406
+ 0x0000, // Translation Offset
407
+ 0x0001, // Length
408
+ ,, )
409
+ })
410
+ }
411
+ }
412
+
413
Scope (\_SB.PCI0)
414
{
415
Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings
416
@@ -XXX,XX +XXX,XX @@
417
WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
418
0x0000, // Granularity
419
0x0000, // Range Minimum
420
- 0x00FF, // Range Maximum
421
+ 0x000F, // Range Maximum
422
0x0000, // Translation Offset
423
- 0x0100, // Length
424
+ 0x0010, // Length
425
,, )
426
IO (Decode16,
427
0x0CF8, // Range Minimum
428
@@ -XXX,XX +XXX,XX @@
429
}
430
}
431
432
+ Device (S10)
433
+ {
434
+ Name (_ADR, 0x00020000) // _ADR: Address
435
+ }
436
+
437
+ Device (S18)
438
+ {
439
+ Name (_ADR, 0x00030000) // _ADR: Address
440
+ }
441
+
442
+ Device (S20)
443
+ {
444
+ Name (_ADR, 0x00040000) // _ADR: Address
445
+ }
446
+
447
+ Device (S28)
448
+ {
449
+ Name (_ADR, 0x00050000) // _ADR: Address
450
+ }
451
+
452
Method (PCNT, 0, NotSerialized)
453
{
454
}
455
456
Reviewed-by: Eric Auger <eric.auger@redhat.com>
38
Reviewed-by: Eric Auger <eric.auger@redhat.com>
457
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
39
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
458
Message-id: 20211210170415.583179-8-jean-philippe@linaro.org
40
Reviewed-by: Marc Zyngier <maz@kernel.org>
41
Tested-by: Zhenyu Zhang <zhenyzha@redhat.com>
42
Message-id: 20221029224307.138822-6-gshan@redhat.com
459
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
43
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
460
---
44
---
461
tests/qtest/bios-tables-test-allowed-diff.h | 2 --
45
include/hw/arm/virt.h | 1 +
462
tests/data/acpi/q35/DSDT.viot | Bin 0 -> 9398 bytes
46
hw/arm/virt.c | 15 ++++++++++-----
463
tests/data/acpi/q35/VIOT.viot | Bin 0 -> 112 bytes
47
2 files changed, 11 insertions(+), 5 deletions(-)
464
3 files changed, 2 deletions(-)
465
48
466
diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
49
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
467
index XXXXXXX..XXXXXXX 100644
50
index XXXXXXX..XXXXXXX 100644
468
--- a/tests/qtest/bios-tables-test-allowed-diff.h
51
--- a/include/hw/arm/virt.h
469
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
52
+++ b/include/hw/arm/virt.h
470
@@ -XXX,XX +XXX,XX @@
53
@@ -XXX,XX +XXX,XX @@ struct VirtMachineState {
471
/* List of comma-separated changed AML files to ignore */
54
PFlashCFI01 *flash[2];
472
"tests/data/acpi/virt/VIOT",
55
bool secure;
473
-"tests/data/acpi/q35/DSDT.viot",
56
bool highmem;
474
-"tests/data/acpi/q35/VIOT.viot",
57
+ bool highmem_compact;
475
diff --git a/tests/data/acpi/q35/DSDT.viot b/tests/data/acpi/q35/DSDT.viot
58
bool highmem_ecam;
59
bool highmem_mmio;
60
bool highmem_redists;
61
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
476
index XXXXXXX..XXXXXXX 100644
62
index XXXXXXX..XXXXXXX 100644
477
GIT binary patch
63
--- a/hw/arm/virt.c
478
literal 9398
64
+++ b/hw/arm/virt.c
479
zcmeHNO>7&-8J*>iv|O&FB}G~Oi$yp||57BBoWHhc5OS9yDTx$CQgH$r;8Idr*-4Q_
65
@@ -XXX,XX +XXX,XX @@ static void virt_set_high_memmap(VirtMachineState *vms,
480
z5(9Az1F`}niVsB-)<KW7p`g9Br(A2Gm-gmc1N78GFS!;)e2V(MnH_0{q<{#yMgn&C
66
vms->memmap[i].size = region_size;
481
zn|*J-d9yqFhO_H6z19~`FlPL*u<DkZ*}|)JH;X@mF-FI<cPg<fti9tEN*yB^i5czN
67
482
zNq&q?!OZ;BE3B7{KWzJ-`Tn~f`9?Qj8~2^N8{Oc8J%57{==w%rS#;nOCp*nTr@iZ1
68
/*
483
zb+?i;JLQUJ=O0?8*>S~D)a>NF1~WVB6^~_B#yhJ`H+JU@=6aXs`?Yv)J2h=N?drcS
69
- * Check each device to see if they fit in the PA space,
484
zeLZ*n<<Bm^n}6`jfBx#u8&(W}1?)}iF9o#mZ~E2+zwdn7yK3AbIzKnxpZ>JRPm3~#
70
- * moving highest_gpa as we go.
485
z&ICS{+_OayRW-l=Mtk=~uaS3o8z<_udd|(wqg`&JnVPfCe>BUOO`Su3e>pff_^UW%
71
+ * Check each device to see if it fits in the PA space,
486
z&JE^NO`)=Amg~iqRB1pPscP?(>#ZuY8GHCmlEvD$9g3%4Db~Dfz2SATnddvrR-Oe^
72
+ * moving highest_gpa as we go. For compatibility, move
487
z;s;dJec!hnzi)ri^I6YN9vtkm{^TdUF8h7gX8-<Qe4p)GQ=)AtYx2VcwdLVAEXEjG
73
+ * highest_gpa for disabled fitting devices as well, if
488
z^Mj|UHPqkj-LsWuzQem1>F3atdZn=zv3$#RmZzSHN+6-yyU#8cJb=YDilX&sl}vNm
74
+ * the compact layout has been disabled.
489
znkgAR^O<3kj4if>{ly5fwRfMWuC5=lrlvKPX~i#654Cp}R_d*JS$9laZ$ra6)<ns8
75
*
490
zFZy28G%xP(nit&F>LDi%G<tIc=TY=gl$jSD&Uv!Yat~XR46h%rI$!}a%!|xG7u8Zn
76
* For each device that doesn't fit, disable it.
491
zeY8_|n=K>xz_v_W8VX$W-Fg-qFWcT}7MCyz{%%{ia7hZ>Law-k6NOr}VI&_48U=2l
77
*/
492
zwqDKFE8eTwwozDdms#e?x?5a|v>&JF;2_v0L~z5n%BYU^52<*cWuD4|GYUm@1+?))
78
fits = (region_base + region_size) <= BIT_ULL(pa_bits);
493
zte^45>Rz)t*<T5V#={r>@t@{%?^i#W{i=HAZ*Dc9y59Va-+#P!jrGs;u38a{fLr`N
79
- if (fits) {
494
zvT@rUu>DljxJ?^&Z?-?vyJn3C>3D=qux{Y*bs5|5n)Qmi$TD^Zdn4GU$ocJS2Hh-<
80
- vms->highest_gpa = region_base + region_size - 1;
495
z`xPI^^+v0nUVdjMos8k`WGl7hA`{03ju%<lrgAHSpd^DRf-*}_#Ly0mB!LSfVgWcQ
81
+ *region_enabled &= fits;
496
z&T$@~G9)JI=hz5m0vkrel+Xy{Oh7pkAu-V!j*W7rY(bO}Q$nMH2`FbGB&N)QaV4<4
82
+ if (vms->highmem_compact && !*region_enabled) {
497
zo)~9JXiP9=;}NPl<C@MmXG&;XFlFNrsyfFsonxFSp<}vEgsRSQP3O3#b6nSnP}ON_
83
+ continue;
498
zI!#Tdsp~|j>ckUB>FI=~GokB5sOq#dotCE4(sd$KbtW~PNlj-`*NIToiD#j5J#9^=
84
}
499
zt?NXn>YUJYPG~wObe#xQos*i*NloXZt`niEb4t@WrRki~bs|)CI+{*L)9L6s5vn><
85
500
zn$DD_Go|Z9sOn5>I@6lYw5}7Os&iV?Ij!lO)^#FOb!If38BJ$K*NIToIiu;E(R9w}
86
- *region_enabled &= fits;
501
zIuWWmPiZ<&X*y5oIuWWmF_XaEC!a&Jn$B5WCqh-{X-(&8P3LJ{Cqh-{8P3dyPr@^t
87
base = region_base + region_size;
502
zSqL9?X9Uwd3W@23*s~h*tj0X6GZCuHa~kuU#yqDp5vt7d8uPryJg+kms?5hU=3^T3
88
+ if (fits) {
503
zF`bD}WnSP+=`t5MQ$FJ_2&Q~+BP6E0f^%BVIW6a$o)e+SX~IDBih-7z6{O~7YTy`&
89
+ vms->highest_gpa = base - 1;
504
zLjy&Cv?7QikV#>n0>>@MV8oK`Gmun34-FKdlm-J8SZSaNlnhir4-FI{S|bfqV8e)V
90
+ }
505
zss<{chX#reE#g=hsKAC%sF6d-Km}BWs!kZFsFpKfpbC@>6rprQGEjt4Ck#|zITHq|
91
}
506
zK*>M_l;<P^MJRQ`Kn0dFVW0|>3{*fllMEE0)CmI>Sk8ojDo`>|0p(0GP=xY&!axO<
92
}
507
zGhv_#lnhirIg<<&q0|Wj6<E%MfhtfkPyyvkGEjt4Ck#|zITHq|K*>M_lrzad5lWpf
93
508
zP=V!47^ngz0~JutBm+e#b;3XemNQ|X3X}{~Ksl2P6rt1!0~J`#gn=qhGEf2KOfpb}
509
zQYQ>lU^x>8szAv=1(Y+%KoLrvFi?TzOc<yFB?A>u&LjgxD0RX>1(q{mpbC@>R6seC
510
z3>2Z%2?G^a&V+#~P%=;f<xDbAgi<FARA4z12C6{GKn0XD$v_cGoiI>=<xCi;0wn_#
511
zP|hR+MJRQ`Kn0dFVW0|>3{*fllMEE0)CmI>Sk8ojDo`>|0p(0GP=rz^3{+q_69%e4
512
z$v_2^Gs!>^N}VuJf#pmXr~)Me6;RG314Srx!axxz28u{EP=u<1B2)}iVZuNaCK;&0
513
zBm-5LFi?dF167!0pbC==RAItE6($T+VUmF=Ofpb~2?JG_Fi?d_2C6X0Kouqo6p_5T
514
zFi=FeV!SiSKoR0H$dH(_Z(*Q_WZ%L-5y`$K14StNmJAdjmWs}HV4<vU_xO+1efmLq
515
zZ;W>N_U)fP6Qy6Nw5mbt9Y(#emWSi66=>tq#xoh#Ue=0qyhxi8ZOUe5y0V7VfPUhp
516
zwX=;ymc+i5%sg9Ja~lZ&8oAV@mHc>&CHP9v4R(jhtT?un;O4e9#pno)Xkh7OWgK&a
517
zyj=3Iv0OuoK_;5rOr5f(Kb~ZXDBO+V`OWYo#_C08imwChQxnjdd?wZLDou8aj;$SD
518
zGDYiA3<$Tu<JnHL(KPOChi#zrR32t83}naR$+ym4P_h?z_5#|cW-nw$XD_sOtE62l
519
zrD3@*)NVyiklt0&yF9%+klsBey&I<Y2E<!f(E8TuJte)z(|ZHyy<^gQVfx}=`q&B5
520
z7nSryp1wGczIaUfVwiq$Fn#<4=@*ssi#+|}K>EdF(l3VTOM~ghPLRH&q%ZOGrGfON
521
zW73zx^yR_y<0nX8R??Sw`tm^f@-gYlNFSp|*<gA{q?Zp5Oe-+l#rmyYmKozi9y=P>
522
zVReJU*h=ZuVXiS$ohTbw-O#v9>(yZbGE|)?8(H1ZIKvV!jWa0>vy!3eMA^vdhQ>`s
523
zuMSg{q3T50$m)j1!HixV<}X9liL#N^4c*tL^y)CF8LCc{jjV3yKAqL8!%SzWI#H%q
524
z=bSrQ&)%JCRttF5g4Zf`6l?y@>PzD7MA^D>wBlcH6r1ucwJ<p0O%rZ?JzIY3-QdmZ
525
zzs|n>`a5r3e|z)wcUaqS>nqFQ-8x}eCF4u`OWUxqst-@1rSmUs%WmKP5e0dcb?e2N
526
z;Z|x*!);VwF|Yuhqs^khqOM!@u*jY!WYldISF(V6`BoNd&6Qfk3>X#SuD^7J>p_D=
527
zBPa51y^_n#=cpOt#Zf$ya$Ae9Mfz56n|<i!a=ELS@)%a{^NIH3SDuN<R~sah1km#P
528
zU@?*f%<rG=4W1wgfi;C?_n|W@%lm$&8YfvNOJodIg&IcIpIJQRHr<+ej11GQ6)&eF
529
z2Lam*jIH}#y0>KnY%4JQfOYS$*uU%f#@$U6`N8I3N-lV?5ErFCdv~xDmu2(wexld4
530
z4v^;aVAT2k6GJ^m*FD(Wqc(Qg^)6a<?}h$zLoj}4;PP!+(O{@!a1y-hoAhF_7!z+6
531
zslpAmNtYbjHrw-~#SPVk_FUf>-Obg6yV`8o$8_`PyJe_;bY5_EMBfBfWU!Q=*9HsG
532
z%_Cda{@_Krr!oHVhv9+y+T5qR8zZ2aZ>5r!$*|f$^U%yBUYfR&B!+EYy_PwL!BeUi
533
zJH^}r3r9Q+B)X@Z)fk=P13w&7x#wBtXTZ)g>WITPg5r&pQc!nmyrmk#S(>>b9xnNr
534
zx_b#v9Xv-Y><Wb%?S^0Xe&<)bbKl_=Z|3C$tf|F<bYzE*mfHB;uC)`q-?buaBe?l?
535
zcLTpK*k<49Z32`K?|nSBMFqxTK^_IE-li2fEGdK~(ZdoKBl6ab4a;Hler#`xvEXJG
536
zb?<E%EZExfX>jcOVhS*0rS~RS1dA#xhkv@Nct@#q?LyeKS<$uFec!bw>{@uu$gZ6a
537
zyVen1i{1BKd%~`D7|m$;U0a<I*3I7%^N%N%lGYdU_GS!gaR8T$NA@GzFi~z`l7hdl
538
zarZy6590|88pi(1zq;V(>38zM0sT&<zX;R5$1w3;`_JMG`;&I&0Y23DMx1%@(w(R9
539
z4M$j;D5J+Gy%fijRQsctzFKf&cv|BAz#YLq3CZJWDdtL4u1u1|mkdcUp7|sxJC+?Y
540
z_@@s`v3j}Q7*z>6X~cwUxUL8G1KT)_XTp!KAbs;vCp{K3&~_X@+ew=-D}v`2MbFV0
541
zQsVsL=rXi-pI*G|iiz;VTCutgUs)hDzV1+4?8KcoP3xROf<M%qC6lgVdpFt4<-|uM
542
z=#rl_b1#YjSIl6Toj2z_hOZcKupkdE(LozC(fN=FY(x|sk)ym|;Rq2E1xJWD%Z!ol
543
Gu>S+TT-130
544
545
literal 0
546
HcmV?d00001
547
548
diff --git a/tests/data/acpi/q35/VIOT.viot b/tests/data/acpi/q35/VIOT.viot
549
index XXXXXXX..XXXXXXX 100644
550
GIT binary patch
551
literal 112
552
zcmWIZ^baXu00LVle`k+i1*eDrX9XZ&1PX!JAex!M0Hgv8m>C3sGzdcgBZCA3T-xBj
553
Q0Zb)W9Hva*zW_`e0M!8s0RR91
554
555
literal 0
556
HcmV?d00001
557
558
--
94
--
559
2.25.1
95
2.25.1
560
561
diff view generated by jsdifflib
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
1
From: Gavin Shan <gshan@redhat.com>
2
2
3
Create empty data files and allow updates for the upcoming VIOT tests.
3
After the improvement to high memory region address assignment is
4
applied, the memory layout can be changed, introducing possible
5
migration breakage. For example, VIRT_HIGH_PCIE_MMIO memory region
6
is disabled or enabled when the optimization is applied or not, with
7
the following configuration. The configuration is only achievable by
8
modifying the source code until more properties are added to allow
9
users selectively disable those high memory regions.
4
10
5
Acked-by: Igor Mammedov <imammedo@redhat.com>
11
pa_bits = 40;
12
vms->highmem_redists = false;
13
vms->highmem_ecam = false;
14
vms->highmem_mmio = true;
15
16
# qemu-system-aarch64 -accel kvm -cpu host \
17
-machine virt-7.2,compact-highmem={on, off} \
18
-m 4G,maxmem=511G -monitor stdio
19
20
Region compact-highmem=off compact-highmem=on
21
----------------------------------------------------------------
22
MEM [1GB 512GB] [1GB 512GB]
23
HIGH_GIC_REDISTS2 [512GB 512GB+64MB] [disabled]
24
HIGH_PCIE_ECAM [512GB+256MB 512GB+512MB] [disabled]
25
HIGH_PCIE_MMIO [disabled] [512GB 1TB]
26
27
In order to keep backwords compatibility, we need to disable the
28
optimization on machine, which is virt-7.1 or ealier than it. It
29
means the optimization is enabled by default from virt-7.2. Besides,
30
'compact-highmem' property is added so that the optimization can be
31
explicitly enabled or disabled on all machine types by users.
32
33
Signed-off-by: Gavin Shan <gshan@redhat.com>
6
Reviewed-by: Eric Auger <eric.auger@redhat.com>
34
Reviewed-by: Eric Auger <eric.auger@redhat.com>
7
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
35
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
8
Message-id: 20211210170415.583179-6-jean-philippe@linaro.org
36
Reviewed-by: Marc Zyngier <maz@kernel.org>
37
Tested-by: Zhenyu Zhang <zhenyzha@redhat.com>
38
Message-id: 20221029224307.138822-7-gshan@redhat.com
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
39
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
40
---
11
tests/qtest/bios-tables-test-allowed-diff.h | 3 +++
41
docs/system/arm/virt.rst | 4 ++++
12
tests/data/acpi/q35/DSDT.viot | 0
42
include/hw/arm/virt.h | 1 +
13
tests/data/acpi/q35/VIOT.viot | 0
43
hw/arm/virt.c | 32 ++++++++++++++++++++++++++++++++
14
tests/data/acpi/virt/VIOT | 0
44
3 files changed, 37 insertions(+)
15
4 files changed, 3 insertions(+)
16
create mode 100644 tests/data/acpi/q35/DSDT.viot
17
create mode 100644 tests/data/acpi/q35/VIOT.viot
18
create mode 100644 tests/data/acpi/virt/VIOT
19
45
20
diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
46
diff --git a/docs/system/arm/virt.rst b/docs/system/arm/virt.rst
21
index XXXXXXX..XXXXXXX 100644
47
index XXXXXXX..XXXXXXX 100644
22
--- a/tests/qtest/bios-tables-test-allowed-diff.h
48
--- a/docs/system/arm/virt.rst
23
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
49
+++ b/docs/system/arm/virt.rst
24
@@ -1 +1,4 @@
50
@@ -XXX,XX +XXX,XX @@ highmem
25
/* List of comma-separated changed AML files to ignore */
51
address space above 32 bits. The default is ``on`` for machine types
26
+"tests/data/acpi/virt/VIOT",
52
later than ``virt-2.12``.
27
+"tests/data/acpi/q35/DSDT.viot",
53
28
+"tests/data/acpi/q35/VIOT.viot",
54
+compact-highmem
29
diff --git a/tests/data/acpi/q35/DSDT.viot b/tests/data/acpi/q35/DSDT.viot
55
+ Set ``on``/``off`` to enable/disable the compact layout for high memory regions.
30
new file mode 100644
56
+ The default is ``on`` for machine types later than ``virt-7.2``.
31
index XXXXXXX..XXXXXXX
57
+
32
diff --git a/tests/data/acpi/q35/VIOT.viot b/tests/data/acpi/q35/VIOT.viot
58
gic-version
33
new file mode 100644
59
Specify the version of the Generic Interrupt Controller (GIC) to provide.
34
index XXXXXXX..XXXXXXX
60
Valid values are:
35
diff --git a/tests/data/acpi/virt/VIOT b/tests/data/acpi/virt/VIOT
61
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
36
new file mode 100644
62
index XXXXXXX..XXXXXXX 100644
37
index XXXXXXX..XXXXXXX
63
--- a/include/hw/arm/virt.h
64
+++ b/include/hw/arm/virt.h
65
@@ -XXX,XX +XXX,XX @@ struct VirtMachineClass {
66
bool no_pmu;
67
bool claim_edge_triggered_timers;
68
bool smbios_old_sys_ver;
69
+ bool no_highmem_compact;
70
bool no_highmem_ecam;
71
bool no_ged; /* Machines < 4.2 have no support for ACPI GED device */
72
bool kvm_no_adjvtime;
73
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
74
index XXXXXXX..XXXXXXX 100644
75
--- a/hw/arm/virt.c
76
+++ b/hw/arm/virt.c
77
@@ -XXX,XX +XXX,XX @@ static const MemMapEntry base_memmap[] = {
78
* Note the extended_memmap is sized so that it eventually also includes the
79
* base_memmap entries (VIRT_HIGH_GIC_REDIST2 index is greater than the last
80
* index of base_memmap).
81
+ *
82
+ * The memory map for these Highmem IO Regions can be in legacy or compact
83
+ * layout, depending on 'compact-highmem' property. With legacy layout, the
84
+ * PA space for one specific region is always reserved, even if the region
85
+ * has been disabled or doesn't fit into the PA space. However, the PA space
86
+ * for the region won't be reserved in these circumstances with compact layout.
87
*/
88
static MemMapEntry extended_memmap[] = {
89
/* Additional 64 MB redist region (can contain up to 512 redistributors) */
90
@@ -XXX,XX +XXX,XX @@ static void virt_set_highmem(Object *obj, bool value, Error **errp)
91
vms->highmem = value;
92
}
93
94
+static bool virt_get_compact_highmem(Object *obj, Error **errp)
95
+{
96
+ VirtMachineState *vms = VIRT_MACHINE(obj);
97
+
98
+ return vms->highmem_compact;
99
+}
100
+
101
+static void virt_set_compact_highmem(Object *obj, bool value, Error **errp)
102
+{
103
+ VirtMachineState *vms = VIRT_MACHINE(obj);
104
+
105
+ vms->highmem_compact = value;
106
+}
107
+
108
static bool virt_get_its(Object *obj, Error **errp)
109
{
110
VirtMachineState *vms = VIRT_MACHINE(obj);
111
@@ -XXX,XX +XXX,XX @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
112
"Set on/off to enable/disable using "
113
"physical address space above 32 bits");
114
115
+ object_class_property_add_bool(oc, "compact-highmem",
116
+ virt_get_compact_highmem,
117
+ virt_set_compact_highmem);
118
+ object_class_property_set_description(oc, "compact-highmem",
119
+ "Set on/off to enable/disable compact "
120
+ "layout for high memory regions");
121
+
122
object_class_property_add_str(oc, "gic-version", virt_get_gic_version,
123
virt_set_gic_version);
124
object_class_property_set_description(oc, "gic-version",
125
@@ -XXX,XX +XXX,XX @@ static void virt_instance_init(Object *obj)
126
127
/* High memory is enabled by default */
128
vms->highmem = true;
129
+ vms->highmem_compact = !vmc->no_highmem_compact;
130
vms->gic_version = VIRT_GIC_VERSION_NOSEL;
131
132
vms->highmem_ecam = !vmc->no_highmem_ecam;
133
@@ -XXX,XX +XXX,XX @@ DEFINE_VIRT_MACHINE_AS_LATEST(7, 2)
134
135
static void virt_machine_7_1_options(MachineClass *mc)
136
{
137
+ VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc));
138
+
139
virt_machine_7_2_options(mc);
140
compat_props_add(mc->compat_props, hw_compat_7_1, hw_compat_7_1_len);
141
+ /* Compact layout for high memory regions was introduced with 7.2 */
142
+ vmc->no_highmem_compact = true;
143
}
144
DEFINE_VIRT_MACHINE(7, 1)
145
38
--
146
--
39
2.25.1
147
2.25.1
40
41
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Gavin Shan <gshan@redhat.com>
2
2
3
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
3
The 3 high memory regions are usually enabled by default, but they may
4
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
4
be not used. For example, VIRT_HIGH_GIC_REDIST2 isn't needed by GICv2.
5
This leads to waste in the PA space.
6
7
Add properties ("highmem-redists", "highmem-ecam", "highmem-mmio") to
8
allow users selectively disable them if needed. After that, the high
9
memory region for GICv3 or GICv4 redistributor can be disabled by user,
10
the number of maximal supported CPUs needs to be calculated based on
11
'vms->highmem_redists'. The follow-up error message is also improved
12
to indicate if the high memory region for GICv3 and GICv4 has been
13
enabled or not.
14
15
Suggested-by: Marc Zyngier <maz@kernel.org>
16
Signed-off-by: Gavin Shan <gshan@redhat.com>
17
Reviewed-by: Marc Zyngier <maz@kernel.org>
18
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
19
Reviewed-by: Eric Auger <eric.auger@redhat.com>
20
Message-id: 20221029224307.138822-8-gshan@redhat.com
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
21
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
---
22
---
7
tests/tcg/aarch64/pcalign-a64.c | 37 +++++++++++++++++++++++++
23
docs/system/arm/virt.rst | 13 +++++++
8
tests/tcg/arm/pcalign-a32.c | 46 +++++++++++++++++++++++++++++++
24
hw/arm/virt.c | 75 ++++++++++++++++++++++++++++++++++++++--
9
tests/tcg/aarch64/Makefile.target | 4 +--
25
2 files changed, 86 insertions(+), 2 deletions(-)
10
tests/tcg/arm/Makefile.target | 4 +++
11
4 files changed, 89 insertions(+), 2 deletions(-)
12
create mode 100644 tests/tcg/aarch64/pcalign-a64.c
13
create mode 100644 tests/tcg/arm/pcalign-a32.c
14
26
15
diff --git a/tests/tcg/aarch64/pcalign-a64.c b/tests/tcg/aarch64/pcalign-a64.c
27
diff --git a/docs/system/arm/virt.rst b/docs/system/arm/virt.rst
16
new file mode 100644
28
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX
29
--- a/docs/system/arm/virt.rst
18
--- /dev/null
30
+++ b/docs/system/arm/virt.rst
19
+++ b/tests/tcg/aarch64/pcalign-a64.c
31
@@ -XXX,XX +XXX,XX @@ compact-highmem
20
@@ -XXX,XX +XXX,XX @@
32
Set ``on``/``off`` to enable/disable the compact layout for high memory regions.
21
+/* Test PC misalignment exception */
33
The default is ``on`` for machine types later than ``virt-7.2``.
34
35
+highmem-redists
36
+ Set ``on``/``off`` to enable/disable the high memory region for GICv3 or
37
+ GICv4 redistributor. The default is ``on``. Setting this to ``off`` will
38
+ limit the maximum number of CPUs when GICv3 or GICv4 is used.
22
+
39
+
23
+#include <assert.h>
40
+highmem-ecam
24
+#include <signal.h>
41
+ Set ``on``/``off`` to enable/disable the high memory region for PCI ECAM.
25
+#include <stdlib.h>
42
+ The default is ``on`` for machine types later than ``virt-3.0``.
26
+#include <stdio.h>
27
+
43
+
28
+static void *expected;
44
+highmem-mmio
45
+ Set ``on``/``off`` to enable/disable the high memory region for PCI MMIO.
46
+ The default is ``on``.
29
+
47
+
30
+static void sigbus(int sig, siginfo_t *info, void *vuc)
48
gic-version
49
Specify the version of the Generic Interrupt Controller (GIC) to provide.
50
Valid values are:
51
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
52
index XXXXXXX..XXXXXXX 100644
53
--- a/hw/arm/virt.c
54
+++ b/hw/arm/virt.c
55
@@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine)
56
if (vms->gic_version == VIRT_GIC_VERSION_2) {
57
virt_max_cpus = GIC_NCPU;
58
} else {
59
- virt_max_cpus = virt_redist_capacity(vms, VIRT_GIC_REDIST) +
60
- virt_redist_capacity(vms, VIRT_HIGH_GIC_REDIST2);
61
+ virt_max_cpus = virt_redist_capacity(vms, VIRT_GIC_REDIST);
62
+ if (vms->highmem_redists) {
63
+ virt_max_cpus += virt_redist_capacity(vms, VIRT_HIGH_GIC_REDIST2);
64
+ }
65
}
66
67
if (max_cpus > virt_max_cpus) {
68
error_report("Number of SMP CPUs requested (%d) exceeds max CPUs "
69
"supported by machine 'mach-virt' (%d)",
70
max_cpus, virt_max_cpus);
71
+ if (vms->gic_version != VIRT_GIC_VERSION_2 && !vms->highmem_redists) {
72
+ error_printf("Try 'highmem-redists=on' for more CPUs\n");
73
+ }
74
+
75
exit(1);
76
}
77
78
@@ -XXX,XX +XXX,XX @@ static void virt_set_compact_highmem(Object *obj, bool value, Error **errp)
79
vms->highmem_compact = value;
80
}
81
82
+static bool virt_get_highmem_redists(Object *obj, Error **errp)
31
+{
83
+{
32
+ assert(info->si_code == BUS_ADRALN);
84
+ VirtMachineState *vms = VIRT_MACHINE(obj);
33
+ assert(info->si_addr == expected);
85
+
34
+ exit(EXIT_SUCCESS);
86
+ return vms->highmem_redists;
35
+}
87
+}
36
+
88
+
37
+int main()
89
+static void virt_set_highmem_redists(Object *obj, bool value, Error **errp)
38
+{
90
+{
39
+ void *tmp;
91
+ VirtMachineState *vms = VIRT_MACHINE(obj);
40
+
92
+
41
+ struct sigaction sa = {
93
+ vms->highmem_redists = value;
42
+ .sa_sigaction = sigbus,
43
+ .sa_flags = SA_SIGINFO
44
+ };
45
+
46
+ if (sigaction(SIGBUS, &sa, NULL) < 0) {
47
+ perror("sigaction");
48
+ return EXIT_FAILURE;
49
+ }
50
+
51
+ asm volatile("adr %0, 1f + 1\n\t"
52
+ "str %0, %1\n\t"
53
+ "br %0\n"
54
+ "1:"
55
+ : "=&r"(tmp), "=m"(expected));
56
+ abort();
57
+}
58
diff --git a/tests/tcg/arm/pcalign-a32.c b/tests/tcg/arm/pcalign-a32.c
59
new file mode 100644
60
index XXXXXXX..XXXXXXX
61
--- /dev/null
62
+++ b/tests/tcg/arm/pcalign-a32.c
63
@@ -XXX,XX +XXX,XX @@
64
+/* Test PC misalignment exception */
65
+
66
+#ifdef __thumb__
67
+#error "This test must be compiled for ARM"
68
+#endif
69
+
70
+#include <assert.h>
71
+#include <signal.h>
72
+#include <stdlib.h>
73
+#include <stdio.h>
74
+
75
+static void *expected;
76
+
77
+static void sigbus(int sig, siginfo_t *info, void *vuc)
78
+{
79
+ assert(info->si_code == BUS_ADRALN);
80
+ assert(info->si_addr == expected);
81
+ exit(EXIT_SUCCESS);
82
+}
94
+}
83
+
95
+
84
+int main()
96
+static bool virt_get_highmem_ecam(Object *obj, Error **errp)
85
+{
97
+{
86
+ void *tmp;
98
+ VirtMachineState *vms = VIRT_MACHINE(obj);
87
+
99
+
88
+ struct sigaction sa = {
100
+ return vms->highmem_ecam;
89
+ .sa_sigaction = sigbus,
101
+}
90
+ .sa_flags = SA_SIGINFO
91
+ };
92
+
102
+
93
+ if (sigaction(SIGBUS, &sa, NULL) < 0) {
103
+static void virt_set_highmem_ecam(Object *obj, bool value, Error **errp)
94
+ perror("sigaction");
104
+{
95
+ return EXIT_FAILURE;
105
+ VirtMachineState *vms = VIRT_MACHINE(obj);
96
+ }
97
+
106
+
98
+ asm volatile("adr %0, 1f + 2\n\t"
107
+ vms->highmem_ecam = value;
99
+ "str %0, %1\n\t"
108
+}
100
+ "bx %0\n"
101
+ "1:"
102
+ : "=&r"(tmp), "=m"(expected));
103
+
109
+
104
+ /*
110
+static bool virt_get_highmem_mmio(Object *obj, Error **errp)
105
+ * From v8, it is CONSTRAINED UNPREDICTABLE whether BXWritePC aligns
111
+{
106
+ * the address or not. If so, we can legitimately fall through.
112
+ VirtMachineState *vms = VIRT_MACHINE(obj);
107
+ */
113
+
108
+ return EXIT_SUCCESS;
114
+ return vms->highmem_mmio;
109
+}
115
+}
110
diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target
111
index XXXXXXX..XXXXXXX 100644
112
--- a/tests/tcg/aarch64/Makefile.target
113
+++ b/tests/tcg/aarch64/Makefile.target
114
@@ -XXX,XX +XXX,XX @@ VPATH         += $(ARM_SRC)
115
AARCH64_SRC=$(SRC_PATH)/tests/tcg/aarch64
116
VPATH         += $(AARCH64_SRC)
117
118
-# Float-convert Tests
119
-AARCH64_TESTS=fcvt
120
+# Base architecture tests
121
+AARCH64_TESTS=fcvt pcalign-a64
122
123
fcvt: LDFLAGS+=-lm
124
125
diff --git a/tests/tcg/arm/Makefile.target b/tests/tcg/arm/Makefile.target
126
index XXXXXXX..XXXXXXX 100644
127
--- a/tests/tcg/arm/Makefile.target
128
+++ b/tests/tcg/arm/Makefile.target
129
@@ -XXX,XX +XXX,XX @@ run-fcvt: fcvt
130
    $(call run-test,fcvt,$(QEMU) $<,"$< on $(TARGET_NAME)")
131
    $(call diff-out,fcvt,$(ARM_SRC)/fcvt.ref)
132
133
+# PC alignment test
134
+ARM_TESTS += pcalign-a32
135
+pcalign-a32: CFLAGS+=-marm
136
+
116
+
137
ifeq ($(CONFIG_ARM_COMPATIBLE_SEMIHOSTING),y)
117
+static void virt_set_highmem_mmio(Object *obj, bool value, Error **errp)
138
118
+{
139
# Semihosting smoke test for linux-user
119
+ VirtMachineState *vms = VIRT_MACHINE(obj);
120
+
121
+ vms->highmem_mmio = value;
122
+}
123
+
124
+
125
static bool virt_get_its(Object *obj, Error **errp)
126
{
127
VirtMachineState *vms = VIRT_MACHINE(obj);
128
@@ -XXX,XX +XXX,XX @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
129
"Set on/off to enable/disable compact "
130
"layout for high memory regions");
131
132
+ object_class_property_add_bool(oc, "highmem-redists",
133
+ virt_get_highmem_redists,
134
+ virt_set_highmem_redists);
135
+ object_class_property_set_description(oc, "highmem-redists",
136
+ "Set on/off to enable/disable high "
137
+ "memory region for GICv3 or GICv4 "
138
+ "redistributor");
139
+
140
+ object_class_property_add_bool(oc, "highmem-ecam",
141
+ virt_get_highmem_ecam,
142
+ virt_set_highmem_ecam);
143
+ object_class_property_set_description(oc, "highmem-ecam",
144
+ "Set on/off to enable/disable high "
145
+ "memory region for PCI ECAM");
146
+
147
+ object_class_property_add_bool(oc, "highmem-mmio",
148
+ virt_get_highmem_mmio,
149
+ virt_set_highmem_mmio);
150
+ object_class_property_set_description(oc, "highmem-mmio",
151
+ "Set on/off to enable/disable high "
152
+ "memory region for PCI MMIO");
153
+
154
object_class_property_add_str(oc, "gic-version", virt_get_gic_version,
155
virt_set_gic_version);
156
object_class_property_set_description(oc, "gic-version",
140
--
157
--
141
2.25.1
158
2.25.1
142
143
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Mihai Carabas <mihai.carabas@oracle.com>
2
2
3
Both single-step and pc alignment faults have priority over
3
Use the base_memmap to build the SMBIOS 19 table which provides the address
4
breakpoint exceptions.
4
mapping for a Physical Memory Array (from spec [1] chapter 7.20).
5
5
6
This was present on i386 from commit c97294ec1b9e36887e119589d456557d72ab37b5
7
("SMBIOS: Build aggregate smbios tables and entry point").
8
9
[1] https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.5.0.pdf
10
11
The absence of this table is a breach of the specs and is
12
detected by the FirmwareTestSuite (FWTS), but it doesn't
13
cause any known problems for guest OSes.
14
15
Signed-off-by: Mihai Carabas <mihai.carabas@oracle.com>
16
Message-id: 1668789029-5432-1-git-send-email-mihai.carabas@oracle.com
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
17
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
19
---
10
target/arm/debug_helper.c | 23 +++++++++++++++++++++++
20
hw/arm/virt.c | 8 +++++++-
11
1 file changed, 23 insertions(+)
21
1 file changed, 7 insertions(+), 1 deletion(-)
12
22
13
diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c
23
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
14
index XXXXXXX..XXXXXXX 100644
24
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/debug_helper.c
25
--- a/hw/arm/virt.c
16
+++ b/target/arm/debug_helper.c
26
+++ b/hw/arm/virt.c
17
@@ -XXX,XX +XXX,XX @@ bool arm_debug_check_breakpoint(CPUState *cs)
27
@@ -XXX,XX +XXX,XX @@ static void *machvirt_dtb(const struct arm_boot_info *binfo, int *fdt_size)
28
static void virt_build_smbios(VirtMachineState *vms)
18
{
29
{
19
ARMCPU *cpu = ARM_CPU(cs);
30
MachineClass *mc = MACHINE_GET_CLASS(vms);
20
CPUARMState *env = &cpu->env;
31
+ MachineState *ms = MACHINE(vms);
21
+ target_ulong pc;
32
VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(vms);
22
int n;
33
uint8_t *smbios_tables, *smbios_anchor;
23
34
size_t smbios_tables_len, smbios_anchor_len;
24
/*
35
+ struct smbios_phys_mem_area mem_array;
25
@@ -XXX,XX +XXX,XX @@ bool arm_debug_check_breakpoint(CPUState *cs)
36
const char *product = "QEMU Virtual Machine";
26
return false;
37
27
}
38
if (kvm_enabled()) {
28
39
@@ -XXX,XX +XXX,XX @@ static void virt_build_smbios(VirtMachineState *vms)
29
+ /*
40
vmc->smbios_old_sys_ver ? "1.0" : mc->name, false,
30
+ * Single-step exceptions have priority over breakpoint exceptions.
41
true, SMBIOS_ENTRY_POINT_TYPE_64);
31
+ * If single-step state is active-pending, suppress the bp.
42
32
+ */
43
- smbios_get_tables(MACHINE(vms), NULL, 0,
33
+ if (arm_singlestep_active(env) && !(env->pstate & PSTATE_SS)) {
44
+ /* build the array of physical mem area from base_memmap */
34
+ return false;
45
+ mem_array.address = vms->memmap[VIRT_MEM].base;
35
+ }
46
+ mem_array.length = ms->ram_size;
36
+
47
+
37
+ /*
48
+ smbios_get_tables(ms, &mem_array, 1,
38
+ * PC alignment faults have priority over breakpoint exceptions.
49
&smbios_tables, &smbios_tables_len,
39
+ */
50
&smbios_anchor, &smbios_anchor_len,
40
+ pc = is_a64(env) ? env->pc : env->regs[15];
51
&error_fatal);
41
+ if ((is_a64(env) || !env->thumb) && (pc & 3) != 0) {
42
+ return false;
43
+ }
44
+
45
+ /*
46
+ * Instruction aborts have priority over breakpoint exceptions.
47
+ * TODO: We would need to look up the page for PC and verify that
48
+ * it is present and executable.
49
+ */
50
+
51
for (n = 0; n < ARRAY_SIZE(env->cpu_breakpoint); n++) {
52
if (bp_wp_matches(cpu, n, false)) {
53
return true;
54
--
52
--
55
2.25.1
53
2.25.1
56
57
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Timofey Kutergin <tkutergin@gmail.com>
2
2
3
We will reuse this section of arm_deliver_fault for
3
The Cortex-A55 is one of the newer armv8.2+ CPUs; in particular
4
raising pc alignment faults.
4
it supports the Privileged Access Never (PAN) feature. Add
5
a model of this CPU, so you can use a CPU type on the virt
6
board that models a specific real hardware CPU, rather than
7
having to use the QEMU-specific "max" CPU type.
5
8
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Signed-off-by: Timofey Kutergin <tkutergin@gmail.com>
10
Message-id: 20221121150819.2782817-1-tkutergin@gmail.com
11
[PMM: tweaked commit message]
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
14
---
10
target/arm/tlb_helper.c | 45 +++++++++++++++++++++++++----------------
15
docs/system/arm/virt.rst | 1 +
11
1 file changed, 28 insertions(+), 17 deletions(-)
16
hw/arm/virt.c | 1 +
17
target/arm/cpu64.c | 69 ++++++++++++++++++++++++++++++++++++++++
18
3 files changed, 71 insertions(+)
12
19
13
diff --git a/target/arm/tlb_helper.c b/target/arm/tlb_helper.c
20
diff --git a/docs/system/arm/virt.rst b/docs/system/arm/virt.rst
14
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/tlb_helper.c
22
--- a/docs/system/arm/virt.rst
16
+++ b/target/arm/tlb_helper.c
23
+++ b/docs/system/arm/virt.rst
17
@@ -XXX,XX +XXX,XX @@ static inline uint32_t merge_syn_data_abort(uint32_t template_syn,
24
@@ -XXX,XX +XXX,XX @@ Supported guest CPU types:
18
return syn;
25
- ``cortex-a15`` (32-bit; the default)
26
- ``cortex-a35`` (64-bit)
27
- ``cortex-a53`` (64-bit)
28
+- ``cortex-a55`` (64-bit)
29
- ``cortex-a57`` (64-bit)
30
- ``cortex-a72`` (64-bit)
31
- ``cortex-a76`` (64-bit)
32
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
33
index XXXXXXX..XXXXXXX 100644
34
--- a/hw/arm/virt.c
35
+++ b/hw/arm/virt.c
36
@@ -XXX,XX +XXX,XX @@ static const char *valid_cpus[] = {
37
ARM_CPU_TYPE_NAME("cortex-a15"),
38
ARM_CPU_TYPE_NAME("cortex-a35"),
39
ARM_CPU_TYPE_NAME("cortex-a53"),
40
+ ARM_CPU_TYPE_NAME("cortex-a55"),
41
ARM_CPU_TYPE_NAME("cortex-a57"),
42
ARM_CPU_TYPE_NAME("cortex-a72"),
43
ARM_CPU_TYPE_NAME("cortex-a76"),
44
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
45
index XXXXXXX..XXXXXXX 100644
46
--- a/target/arm/cpu64.c
47
+++ b/target/arm/cpu64.c
48
@@ -XXX,XX +XXX,XX @@ static void aarch64_a53_initfn(Object *obj)
49
define_cortex_a72_a57_a53_cp_reginfo(cpu);
19
}
50
}
20
51
21
-static void QEMU_NORETURN arm_deliver_fault(ARMCPU *cpu, vaddr addr,
52
+static void aarch64_a55_initfn(Object *obj)
22
- MMUAccessType access_type,
53
+{
23
- int mmu_idx, ARMMMUFaultInfo *fi)
54
+ ARMCPU *cpu = ARM_CPU(obj);
24
+static uint32_t compute_fsr_fsc(CPUARMState *env, ARMMMUFaultInfo *fi,
55
+
25
+ int target_el, int mmu_idx, uint32_t *ret_fsc)
56
+ cpu->dtb_compatible = "arm,cortex-a55";
26
{
57
+ set_feature(&cpu->env, ARM_FEATURE_V8);
27
- CPUARMState *env = &cpu->env;
58
+ set_feature(&cpu->env, ARM_FEATURE_NEON);
28
- int target_el;
59
+ set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER);
29
- bool same_el;
60
+ set_feature(&cpu->env, ARM_FEATURE_AARCH64);
30
- uint32_t syn, exc, fsr, fsc;
61
+ set_feature(&cpu->env, ARM_FEATURE_CBAR_RO);
31
ARMMMUIdx arm_mmu_idx = core_to_arm_mmu_idx(env, mmu_idx);
62
+ set_feature(&cpu->env, ARM_FEATURE_EL2);
32
-
63
+ set_feature(&cpu->env, ARM_FEATURE_EL3);
33
- target_el = exception_target_el(env);
64
+ set_feature(&cpu->env, ARM_FEATURE_PMU);
34
- if (fi->stage2) {
65
+
35
- target_el = 2;
66
+ /* Ordered by B2.4 AArch64 registers by functional group */
36
- env->cp15.hpfar_el2 = extract64(fi->s2addr, 12, 47) << 4;
67
+ cpu->clidr = 0x82000023;
37
- if (arm_is_secure_below_el3(env) && fi->s1ns) {
68
+ cpu->ctr = 0x84448004; /* L1Ip = VIPT */
38
- env->cp15.hpfar_el2 |= HPFAR_NS;
69
+ cpu->dcz_blocksize = 4; /* 64 bytes */
39
- }
70
+ cpu->isar.id_aa64dfr0 = 0x0000000010305408ull;
40
- }
71
+ cpu->isar.id_aa64isar0 = 0x0000100010211120ull;
41
- same_el = (arm_current_el(env) == target_el);
72
+ cpu->isar.id_aa64isar1 = 0x0000000000100001ull;
42
+ uint32_t fsr, fsc;
73
+ cpu->isar.id_aa64mmfr0 = 0x0000000000101122ull;
43
74
+ cpu->isar.id_aa64mmfr1 = 0x0000000010212122ull;
44
if (target_el == 2 || arm_el_is_aa64(env, target_el) ||
75
+ cpu->isar.id_aa64mmfr2 = 0x0000000000001011ull;
45
arm_s1_regime_using_lpae_format(env, arm_mmu_idx)) {
76
+ cpu->isar.id_aa64pfr0 = 0x0000000010112222ull;
46
@@ -XXX,XX +XXX,XX @@ static void QEMU_NORETURN arm_deliver_fault(ARMCPU *cpu, vaddr addr,
77
+ cpu->isar.id_aa64pfr1 = 0x0000000000000010ull;
47
fsc = 0x3f;
78
+ cpu->id_afr0 = 0x00000000;
48
}
79
+ cpu->isar.id_dfr0 = 0x04010088;
49
80
+ cpu->isar.id_isar0 = 0x02101110;
50
+ *ret_fsc = fsc;
81
+ cpu->isar.id_isar1 = 0x13112111;
51
+ return fsr;
82
+ cpu->isar.id_isar2 = 0x21232042;
83
+ cpu->isar.id_isar3 = 0x01112131;
84
+ cpu->isar.id_isar4 = 0x00011142;
85
+ cpu->isar.id_isar5 = 0x01011121;
86
+ cpu->isar.id_isar6 = 0x00000010;
87
+ cpu->isar.id_mmfr0 = 0x10201105;
88
+ cpu->isar.id_mmfr1 = 0x40000000;
89
+ cpu->isar.id_mmfr2 = 0x01260000;
90
+ cpu->isar.id_mmfr3 = 0x02122211;
91
+ cpu->isar.id_mmfr4 = 0x00021110;
92
+ cpu->isar.id_pfr0 = 0x10010131;
93
+ cpu->isar.id_pfr1 = 0x00011011;
94
+ cpu->isar.id_pfr2 = 0x00000011;
95
+ cpu->midr = 0x412FD050; /* r2p0 */
96
+ cpu->revidr = 0;
97
+
98
+ /* From B2.23 CCSIDR_EL1 */
99
+ cpu->ccsidr[0] = 0x700fe01a; /* 32KB L1 dcache */
100
+ cpu->ccsidr[1] = 0x200fe01a; /* 32KB L1 icache */
101
+ cpu->ccsidr[2] = 0x703fe07a; /* 512KB L2 cache */
102
+
103
+ /* From B2.96 SCTLR_EL3 */
104
+ cpu->reset_sctlr = 0x30c50838;
105
+
106
+ /* From B4.45 ICH_VTR_EL2 */
107
+ cpu->gic_num_lrs = 4;
108
+ cpu->gic_vpribits = 5;
109
+ cpu->gic_vprebits = 5;
110
+ cpu->gic_pribits = 5;
111
+
112
+ cpu->isar.mvfr0 = 0x10110222;
113
+ cpu->isar.mvfr1 = 0x13211111;
114
+ cpu->isar.mvfr2 = 0x00000043;
115
+
116
+ /* From D5.4 AArch64 PMU register summary */
117
+ cpu->isar.reset_pmcr_el0 = 0x410b3000;
52
+}
118
+}
53
+
119
+
54
+static void QEMU_NORETURN arm_deliver_fault(ARMCPU *cpu, vaddr addr,
120
static void aarch64_a72_initfn(Object *obj)
55
+ MMUAccessType access_type,
121
{
56
+ int mmu_idx, ARMMMUFaultInfo *fi)
122
ARMCPU *cpu = ARM_CPU(obj);
57
+{
123
@@ -XXX,XX +XXX,XX @@ static const ARMCPUInfo aarch64_cpus[] = {
58
+ CPUARMState *env = &cpu->env;
124
{ .name = "cortex-a35", .initfn = aarch64_a35_initfn },
59
+ int target_el;
125
{ .name = "cortex-a57", .initfn = aarch64_a57_initfn },
60
+ bool same_el;
126
{ .name = "cortex-a53", .initfn = aarch64_a53_initfn },
61
+ uint32_t syn, exc, fsr, fsc;
127
+ { .name = "cortex-a55", .initfn = aarch64_a55_initfn },
62
+
128
{ .name = "cortex-a72", .initfn = aarch64_a72_initfn },
63
+ target_el = exception_target_el(env);
129
{ .name = "cortex-a76", .initfn = aarch64_a76_initfn },
64
+ if (fi->stage2) {
130
{ .name = "a64fx", .initfn = aarch64_a64fx_initfn },
65
+ target_el = 2;
66
+ env->cp15.hpfar_el2 = extract64(fi->s2addr, 12, 47) << 4;
67
+ if (arm_is_secure_below_el3(env) && fi->s1ns) {
68
+ env->cp15.hpfar_el2 |= HPFAR_NS;
69
+ }
70
+ }
71
+ same_el = (arm_current_el(env) == target_el);
72
+
73
+ fsr = compute_fsr_fsc(env, fi, target_el, mmu_idx, &fsc);
74
+
75
if (access_type == MMU_INST_FETCH) {
76
syn = syn_insn_abort(same_el, fi->ea, fi->s1ptw, fsc);
77
exc = EXCP_PREFETCH_ABORT;
78
--
131
--
79
2.25.1
132
2.25.1
80
81
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Luke Starrett <lukes@xsightlabs.com>
2
2
3
The size of the code covered by a TranslationBlock cannot be 0;
3
The ARM GICv3 TRM describes that the ITLinesNumber field of GICD_TYPER
4
this is checked via assert in tb_gen_code.
4
register:
5
5
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
"indicates the maximum SPI INTID that the GIC implementation supports"
7
8
As SPI #0 is absolute IRQ #32, the max SPI INTID should have accounted
9
for the internal 16x SGI's and 16x PPI's. However, the original GICv3
10
model subtracted off the SGI/PPI. Cosmetically this can be seen at OS
11
boot (Linux) showing 32 shy of what should be there, i.e.:
12
13
[ 0.000000] GICv3: 224 SPIs implemented
14
15
Though in hw/arm/virt.c, the machine is configured for 256 SPI's. ARM
16
virt machine likely doesn't have a problem with this because the upper
17
32 IRQ's don't actually have anything meaningful wired. But, this does
18
become a functional issue on a custom use case which wants to make use
19
of these IRQ's. Additionally, boot code (i.e. TF-A) will only init up
20
to the number (blocks of 32) that it believes to actually be there.
21
22
Signed-off-by: Luke Starrett <lukes@xsightlabs.com>
23
Message-id: AM9P193MB168473D99B761E204E032095D40D9@AM9P193MB1684.EURP193.PROD.OUTLOOK.COM
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
24
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
25
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
26
---
10
target/arm/translate-a64.c | 1 +
27
hw/intc/arm_gicv3_dist.c | 4 ++--
11
1 file changed, 1 insertion(+)
28
1 file changed, 2 insertions(+), 2 deletions(-)
12
29
13
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
30
diff --git a/hw/intc/arm_gicv3_dist.c b/hw/intc/arm_gicv3_dist.c
14
index XXXXXXX..XXXXXXX 100644
31
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/translate-a64.c
32
--- a/hw/intc/arm_gicv3_dist.c
16
+++ b/target/arm/translate-a64.c
33
+++ b/hw/intc/arm_gicv3_dist.c
17
@@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
34
@@ -XXX,XX +XXX,XX @@ static bool gicd_readl(GICv3State *s, hwaddr offset,
18
assert(s->base.num_insns == 1);
35
* MBIS == 0 (message-based SPIs not supported)
19
gen_swstep_exception(s, 0, 0);
36
* SecurityExtn == 1 if security extns supported
20
s->base.is_jmp = DISAS_NORETURN;
37
* CPUNumber == 0 since for us ARE is always 1
21
+ s->base.pc_next = pc + 4;
38
- * ITLinesNumber == (num external irqs / 32) - 1
22
return;
39
+ * ITLinesNumber == (((max SPI IntID + 1) / 32) - 1)
23
}
40
*/
24
41
- int itlinesnumber = ((s->num_irq - GIC_INTERNAL) / 32) - 1;
42
+ int itlinesnumber = (s->num_irq / 32) - 1;
43
/*
44
* SecurityExtn must be RAZ if GICD_CTLR.DS == 1, and
45
* "security extensions not supported" always implies DS == 1,
25
--
46
--
26
2.25.1
47
2.25.1
27
28
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
FEAT_EVT adds five new bits to the HCR_EL2 register: TTLBIS, TTLBOS,
2
TICAB, TOCU and TID4. These allow the guest to enable trapping of
3
various EL1 instructions to EL2. In this commit, add the necessary
4
code to allow the guest to set these bits if the feature is present;
5
because the bit is always zero when the feature isn't present we
6
won't need to use explicit feature checks in the "trap on condition"
7
tests in the following commits.
2
8
3
For A64, any input to an indirect branch can cause this.
9
Note that although full implementation of the feature (mandatory from
10
Armv8.5 onward) requires all five trap bits, the ID registers permit
11
a value indicating that only TICAB, TOCU and TID4 are implemented,
12
which might be the case for CPUs between Armv8.2 and Armv8.5.
4
13
5
For A32, many indirect branch paths force the branch to be aligned,
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
but BXWritePC does not. This includes the BX instruction but also
15
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
other interworking changes to PC. Prior to v8, this case is UNDEFINED.
16
---
8
With v8, this is CONSTRAINED UNPREDICTABLE and may either raise an
17
target/arm/cpu.h | 30 ++++++++++++++++++++++++++++++
9
exception or force align the PC.
18
target/arm/helper.c | 6 ++++++
19
2 files changed, 36 insertions(+)
10
20
11
We choose to raise an exception because we have the infrastructure,
21
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
12
it makes the generated code for gen_bx simpler, and it has the
13
possibility of catching more guest bugs.
14
15
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
---
19
target/arm/helper.h | 1 +
20
target/arm/syndrome.h | 5 ++++
21
linux-user/aarch64/cpu_loop.c | 46 ++++++++++++++++++++---------------
22
target/arm/tlb_helper.c | 18 ++++++++++++++
23
target/arm/translate-a64.c | 15 ++++++++++++
24
target/arm/translate.c | 22 ++++++++++++++++-
25
6 files changed, 87 insertions(+), 20 deletions(-)
26
27
diff --git a/target/arm/helper.h b/target/arm/helper.h
28
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
29
--- a/target/arm/helper.h
23
--- a/target/arm/cpu.h
30
+++ b/target/arm/helper.h
24
+++ b/target/arm/cpu.h
31
@@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_3(sel_flags, TCG_CALL_NO_RWG_SE,
25
@@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa32_tts2uxn(const ARMISARegisters *id)
32
DEF_HELPER_2(exception_internal, void, env, i32)
26
return FIELD_EX32(id->id_mmfr4, ID_MMFR4, XNX) != 0;
33
DEF_HELPER_4(exception_with_syndrome, void, env, i32, i32, i32)
34
DEF_HELPER_2(exception_bkpt_insn, void, env, i32)
35
+DEF_HELPER_2(exception_pc_alignment, noreturn, env, tl)
36
DEF_HELPER_1(setend, void, env)
37
DEF_HELPER_2(wfi, void, env, i32)
38
DEF_HELPER_1(wfe, void, env)
39
diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h
40
index XXXXXXX..XXXXXXX 100644
41
--- a/target/arm/syndrome.h
42
+++ b/target/arm/syndrome.h
43
@@ -XXX,XX +XXX,XX @@ static inline uint32_t syn_illegalstate(void)
44
return (EC_ILLEGALSTATE << ARM_EL_EC_SHIFT) | ARM_EL_IL;
45
}
27
}
46
28
47
+static inline uint32_t syn_pcalignment(void)
29
+static inline bool isar_feature_aa32_half_evt(const ARMISARegisters *id)
48
+{
30
+{
49
+ return (EC_PCALIGNMENT << ARM_EL_EC_SHIFT) | ARM_EL_IL;
31
+ return FIELD_EX32(id->id_mmfr4, ID_MMFR4, EVT) >= 1;
50
+}
32
+}
51
+
33
+
52
#endif /* TARGET_ARM_SYNDROME_H */
34
+static inline bool isar_feature_aa32_evt(const ARMISARegisters *id)
53
diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c
54
index XXXXXXX..XXXXXXX 100644
55
--- a/linux-user/aarch64/cpu_loop.c
56
+++ b/linux-user/aarch64/cpu_loop.c
57
@@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env)
58
break;
59
case EXCP_PREFETCH_ABORT:
60
case EXCP_DATA_ABORT:
61
- /* We should only arrive here with EC in {DATAABORT, INSNABORT}. */
62
ec = syn_get_ec(env->exception.syndrome);
63
- assert(ec == EC_DATAABORT || ec == EC_INSNABORT);
64
-
65
- /* Both EC have the same format for FSC, or close enough. */
66
- fsc = extract32(env->exception.syndrome, 0, 6);
67
- switch (fsc) {
68
- case 0x04 ... 0x07: /* Translation fault, level {0-3} */
69
- si_signo = TARGET_SIGSEGV;
70
- si_code = TARGET_SEGV_MAPERR;
71
+ switch (ec) {
72
+ case EC_DATAABORT:
73
+ case EC_INSNABORT:
74
+ /* Both EC have the same format for FSC, or close enough. */
75
+ fsc = extract32(env->exception.syndrome, 0, 6);
76
+ switch (fsc) {
77
+ case 0x04 ... 0x07: /* Translation fault, level {0-3} */
78
+ si_signo = TARGET_SIGSEGV;
79
+ si_code = TARGET_SEGV_MAPERR;
80
+ break;
81
+ case 0x09 ... 0x0b: /* Access flag fault, level {1-3} */
82
+ case 0x0d ... 0x0f: /* Permission fault, level {1-3} */
83
+ si_signo = TARGET_SIGSEGV;
84
+ si_code = TARGET_SEGV_ACCERR;
85
+ break;
86
+ case 0x11: /* Synchronous Tag Check Fault */
87
+ si_signo = TARGET_SIGSEGV;
88
+ si_code = TARGET_SEGV_MTESERR;
89
+ break;
90
+ case 0x21: /* Alignment fault */
91
+ si_signo = TARGET_SIGBUS;
92
+ si_code = TARGET_BUS_ADRALN;
93
+ break;
94
+ default:
95
+ g_assert_not_reached();
96
+ }
97
break;
98
- case 0x09 ... 0x0b: /* Access flag fault, level {1-3} */
99
- case 0x0d ... 0x0f: /* Permission fault, level {1-3} */
100
- si_signo = TARGET_SIGSEGV;
101
- si_code = TARGET_SEGV_ACCERR;
102
- break;
103
- case 0x11: /* Synchronous Tag Check Fault */
104
- si_signo = TARGET_SIGSEGV;
105
- si_code = TARGET_SEGV_MTESERR;
106
- break;
107
- case 0x21: /* Alignment fault */
108
+ case EC_PCALIGNMENT:
109
si_signo = TARGET_SIGBUS;
110
si_code = TARGET_BUS_ADRALN;
111
break;
112
diff --git a/target/arm/tlb_helper.c b/target/arm/tlb_helper.c
113
index XXXXXXX..XXXXXXX 100644
114
--- a/target/arm/tlb_helper.c
115
+++ b/target/arm/tlb_helper.c
116
@@ -XXX,XX +XXX,XX @@
117
#include "cpu.h"
118
#include "internals.h"
119
#include "exec/exec-all.h"
120
+#include "exec/helper-proto.h"
121
122
static inline uint32_t merge_syn_data_abort(uint32_t template_syn,
123
unsigned int target_el,
124
@@ -XXX,XX +XXX,XX @@ void arm_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr,
125
arm_deliver_fault(cpu, vaddr, access_type, mmu_idx, &fi);
126
}
127
128
+void helper_exception_pc_alignment(CPUARMState *env, target_ulong pc)
129
+{
35
+{
130
+ ARMMMUFaultInfo fi = { .type = ARMFault_Alignment };
36
+ return FIELD_EX32(id->id_mmfr4, ID_MMFR4, EVT) >= 2;
131
+ int target_el = exception_target_el(env);
132
+ int mmu_idx = cpu_mmu_index(env, true);
133
+ uint32_t fsc;
134
+
135
+ env->exception.vaddress = pc;
136
+
137
+ /*
138
+ * Note that the fsc is not applicable to this exception,
139
+ * since any syndrome is pcalignment not insn_abort.
140
+ */
141
+ env->exception.fsr = compute_fsr_fsc(env, &fi, target_el, mmu_idx, &fsc);
142
+ raise_exception(env, EXCP_PREFETCH_ABORT, syn_pcalignment(), target_el);
143
+}
37
+}
144
+
38
+
145
#if !defined(CONFIG_USER_ONLY)
39
static inline bool isar_feature_aa32_dit(const ARMISARegisters *id)
146
40
{
41
return FIELD_EX32(id->id_pfr0, ID_PFR0, DIT) != 0;
42
@@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_ids(const ARMISARegisters *id)
43
return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, IDS) != 0;
44
}
45
46
+static inline bool isar_feature_aa64_half_evt(const ARMISARegisters *id)
47
+{
48
+ return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, EVT) >= 1;
49
+}
50
+
51
+static inline bool isar_feature_aa64_evt(const ARMISARegisters *id)
52
+{
53
+ return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, EVT) >= 2;
54
+}
55
+
56
static inline bool isar_feature_aa64_bti(const ARMISARegisters *id)
57
{
58
return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, BT) != 0;
59
@@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_any_ras(const ARMISARegisters *id)
60
return isar_feature_aa64_ras(id) || isar_feature_aa32_ras(id);
61
}
62
63
+static inline bool isar_feature_any_half_evt(const ARMISARegisters *id)
64
+{
65
+ return isar_feature_aa64_half_evt(id) || isar_feature_aa32_half_evt(id);
66
+}
67
+
68
+static inline bool isar_feature_any_evt(const ARMISARegisters *id)
69
+{
70
+ return isar_feature_aa64_evt(id) || isar_feature_aa32_evt(id);
71
+}
72
+
147
/*
73
/*
148
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
74
* Forward to the above feature tests given an ARMCPU pointer.
75
*/
76
diff --git a/target/arm/helper.c b/target/arm/helper.c
149
index XXXXXXX..XXXXXXX 100644
77
index XXXXXXX..XXXXXXX 100644
150
--- a/target/arm/translate-a64.c
78
--- a/target/arm/helper.c
151
+++ b/target/arm/translate-a64.c
79
+++ b/target/arm/helper.c
152
@@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
80
@@ -XXX,XX +XXX,XX @@ static void do_hcr_write(CPUARMState *env, uint64_t value, uint64_t valid_mask)
153
uint64_t pc = s->base.pc_next;
81
}
154
uint32_t insn;
155
156
+ /* Singlestep exceptions have the highest priority. */
157
if (s->ss_active && !s->pstate_ss) {
158
/* Singlestep state is Active-pending.
159
* If we're in this state at the start of a TB then either
160
@@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
161
return;
162
}
82
}
163
83
164
+ if (pc & 3) {
84
+ if (cpu_isar_feature(any_evt, cpu)) {
165
+ /*
85
+ valid_mask |= HCR_TTLBIS | HCR_TTLBOS | HCR_TICAB | HCR_TOCU | HCR_TID4;
166
+ * PC alignment fault. This has priority over the instruction abort
86
+ } else if (cpu_isar_feature(any_half_evt, cpu)) {
167
+ * that we would receive from a translation fault via arm_ldl_code.
87
+ valid_mask |= HCR_TICAB | HCR_TOCU | HCR_TID4;
168
+ * This should only be possible after an indirect branch, at the
169
+ * start of the TB.
170
+ */
171
+ assert(s->base.num_insns == 1);
172
+ gen_helper_exception_pc_alignment(cpu_env, tcg_constant_tl(pc));
173
+ s->base.is_jmp = DISAS_NORETURN;
174
+ s->base.pc_next = QEMU_ALIGN_UP(pc, 4);
175
+ return;
176
+ }
88
+ }
177
+
89
+
178
s->pc_curr = pc;
90
/* Clear RES0 bits. */
179
insn = arm_ldl_code(env, &s->base, pc, s->sctlr_b);
91
value &= valid_mask;
180
s->insn = insn;
92
181
diff --git a/target/arm/translate.c b/target/arm/translate.c
182
index XXXXXXX..XXXXXXX 100644
183
--- a/target/arm/translate.c
184
+++ b/target/arm/translate.c
185
@@ -XXX,XX +XXX,XX @@ static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
186
uint32_t pc = dc->base.pc_next;
187
unsigned int insn;
188
189
- if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) {
190
+ /* Singlestep exceptions have the highest priority. */
191
+ if (arm_check_ss_active(dc)) {
192
+ dc->base.pc_next = pc + 4;
193
+ return;
194
+ }
195
+
196
+ if (pc & 3) {
197
+ /*
198
+ * PC alignment fault. This has priority over the instruction abort
199
+ * that we would receive from a translation fault via arm_ldl_code
200
+ * (or the execution of the kernelpage entrypoint). This should only
201
+ * be possible after an indirect branch, at the start of the TB.
202
+ */
203
+ assert(dc->base.num_insns == 1);
204
+ gen_helper_exception_pc_alignment(cpu_env, tcg_constant_tl(pc));
205
+ dc->base.is_jmp = DISAS_NORETURN;
206
+ dc->base.pc_next = QEMU_ALIGN_UP(pc, 4);
207
+ return;
208
+ }
209
+
210
+ if (arm_check_kernelpage(dc)) {
211
dc->base.pc_next = pc + 4;
212
return;
213
}
214
--
93
--
215
2.25.1
94
2.25.1
216
217
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
For FEAT_EVT, the HCR_EL2.TTLBIS bit allows trapping on EL1 use of
2
TLB maintenance instructions that operate on the inner shareable
3
domain:
2
4
3
Misaligned thumb PC is architecturally impossible.
5
AArch64:
4
Assert is better than proceeding, in case we've missed
6
TLBI VMALLE1IS, TLBI VAE1IS, TLBI ASIDE1IS, TLBI VAAE1IS,
5
something somewhere.
7
TLBI VALE1IS, TLBI VAALE1IS, TLBI RVAE1IS, TLBI RVAAE1IS,
8
TLBI RVALE1IS, and TLBI RVAALE1IS.
6
9
7
Expand a comment about aligning the pc in gdbstub.
10
AArch32:
8
Fail an incoming migrate if a thumb pc is misaligned.
11
TLBIALLIS, TLBIMVAIS, TLBIASIDIS, TLBIMVAAIS, TLBIMVALIS,
12
and TLBIMVAALIS.
9
13
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
14
Add the trapping support.
11
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
15
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
13
---
18
---
14
target/arm/gdbstub.c | 9 +++++++--
19
target/arm/helper.c | 43 +++++++++++++++++++++++++++----------------
15
target/arm/machine.c | 10 ++++++++++
20
1 file changed, 27 insertions(+), 16 deletions(-)
16
target/arm/translate.c | 3 +++
17
3 files changed, 20 insertions(+), 2 deletions(-)
18
21
19
diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c
22
diff --git a/target/arm/helper.c b/target/arm/helper.c
20
index XXXXXXX..XXXXXXX 100644
23
index XXXXXXX..XXXXXXX 100644
21
--- a/target/arm/gdbstub.c
24
--- a/target/arm/helper.c
22
+++ b/target/arm/gdbstub.c
25
+++ b/target/arm/helper.c
23
@@ -XXX,XX +XXX,XX @@ int arm_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
26
@@ -XXX,XX +XXX,XX @@ static CPAccessResult access_ttlb(CPUARMState *env, const ARMCPRegInfo *ri,
24
27
return CP_ACCESS_OK;
25
tmp = ldl_p(mem_buf);
28
}
26
29
27
- /* Mask out low bit of PC to workaround gdb bugs. This will probably
30
+/* Check for traps from EL1 due to HCR_EL2.TTLB or TTLBIS. */
28
- cause problems if we ever implement the Jazelle DBX extensions. */
31
+static CPAccessResult access_ttlbis(CPUARMState *env, const ARMCPRegInfo *ri,
29
+ /*
32
+ bool isread)
30
+ * Mask out low bits of PC to workaround gdb bugs.
33
+{
31
+ * This avoids an assert in thumb_tr_translate_insn, because it is
34
+ if (arm_current_el(env) == 1 &&
32
+ * architecturally impossible to misalign the pc.
35
+ (arm_hcr_el2_eff(env) & (HCR_TTLB | HCR_TTLBIS))) {
33
+ * This will probably cause problems if we ever implement the
36
+ return CP_ACCESS_TRAP_EL2;
34
+ * Jazelle DBX extensions.
37
+ }
35
+ */
38
+ return CP_ACCESS_OK;
36
if (n == 15) {
39
+}
37
tmp &= ~1;
38
}
39
diff --git a/target/arm/machine.c b/target/arm/machine.c
40
index XXXXXXX..XXXXXXX 100644
41
--- a/target/arm/machine.c
42
+++ b/target/arm/machine.c
43
@@ -XXX,XX +XXX,XX @@ static int cpu_post_load(void *opaque, int version_id)
44
return -1;
45
}
46
}
47
+
40
+
48
+ /*
41
static void dacr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)
49
+ * Misaligned thumb pc is architecturally impossible.
42
{
50
+ * We have an assert in thumb_tr_translate_insn to verify this.
43
ARMCPU *cpu = env_archcpu(env);
51
+ * Fail an incoming migrate to avoid this assert.
44
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = {
52
+ */
45
static const ARMCPRegInfo v7mp_cp_reginfo[] = {
53
+ if (!is_a64(env) && env->thumb && (env->regs[15] & 1)) {
46
/* 32 bit TLB invalidates, Inner Shareable */
54
+ return -1;
47
{ .name = "TLBIALLIS", .cp = 15, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 0,
55
+ }
48
- .type = ARM_CP_NO_RAW, .access = PL1_W, .accessfn = access_ttlb,
56
+
49
+ .type = ARM_CP_NO_RAW, .access = PL1_W, .accessfn = access_ttlbis,
57
if (!kvm_enabled()) {
50
.writefn = tlbiall_is_write },
58
pmu_op_finish(&cpu->env);
51
{ .name = "TLBIMVAIS", .cp = 15, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 1,
59
}
52
- .type = ARM_CP_NO_RAW, .access = PL1_W, .accessfn = access_ttlb,
60
diff --git a/target/arm/translate.c b/target/arm/translate.c
53
+ .type = ARM_CP_NO_RAW, .access = PL1_W, .accessfn = access_ttlbis,
61
index XXXXXXX..XXXXXXX 100644
54
.writefn = tlbimva_is_write },
62
--- a/target/arm/translate.c
55
{ .name = "TLBIASIDIS", .cp = 15, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 2,
63
+++ b/target/arm/translate.c
56
- .type = ARM_CP_NO_RAW, .access = PL1_W, .accessfn = access_ttlb,
64
@@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
57
+ .type = ARM_CP_NO_RAW, .access = PL1_W, .accessfn = access_ttlbis,
65
uint32_t insn;
58
.writefn = tlbiasid_is_write },
66
bool is_16bit;
59
{ .name = "TLBIMVAAIS", .cp = 15, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 3,
67
60
- .type = ARM_CP_NO_RAW, .access = PL1_W, .accessfn = access_ttlb,
68
+ /* Misaligned thumb PC is architecturally impossible. */
61
+ .type = ARM_CP_NO_RAW, .access = PL1_W, .accessfn = access_ttlbis,
69
+ assert((dc->base.pc_next & 1) == 0);
62
.writefn = tlbimvaa_is_write },
70
+
63
};
71
if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) {
64
72
dc->base.pc_next = pc + 2;
65
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
73
return;
66
/* TLBI operations */
67
{ .name = "TLBI_VMALLE1IS", .state = ARM_CP_STATE_AA64,
68
.opc0 = 1, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 0,
69
- .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW,
70
+ .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW,
71
.writefn = tlbi_aa64_vmalle1is_write },
72
{ .name = "TLBI_VAE1IS", .state = ARM_CP_STATE_AA64,
73
.opc0 = 1, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 1,
74
- .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW,
75
+ .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW,
76
.writefn = tlbi_aa64_vae1is_write },
77
{ .name = "TLBI_ASIDE1IS", .state = ARM_CP_STATE_AA64,
78
.opc0 = 1, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 2,
79
- .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW,
80
+ .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW,
81
.writefn = tlbi_aa64_vmalle1is_write },
82
{ .name = "TLBI_VAAE1IS", .state = ARM_CP_STATE_AA64,
83
.opc0 = 1, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 3,
84
- .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW,
85
+ .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW,
86
.writefn = tlbi_aa64_vae1is_write },
87
{ .name = "TLBI_VALE1IS", .state = ARM_CP_STATE_AA64,
88
.opc0 = 1, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 5,
89
- .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW,
90
+ .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW,
91
.writefn = tlbi_aa64_vae1is_write },
92
{ .name = "TLBI_VAALE1IS", .state = ARM_CP_STATE_AA64,
93
.opc0 = 1, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 7,
94
- .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW,
95
+ .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW,
96
.writefn = tlbi_aa64_vae1is_write },
97
{ .name = "TLBI_VMALLE1", .state = ARM_CP_STATE_AA64,
98
.opc0 = 1, .opc1 = 0, .crn = 8, .crm = 7, .opc2 = 0,
99
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
100
#endif
101
/* TLB invalidate last level of translation table walk */
102
{ .name = "TLBIMVALIS", .cp = 15, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 5,
103
- .type = ARM_CP_NO_RAW, .access = PL1_W, .accessfn = access_ttlb,
104
+ .type = ARM_CP_NO_RAW, .access = PL1_W, .accessfn = access_ttlbis,
105
.writefn = tlbimva_is_write },
106
{ .name = "TLBIMVAALIS", .cp = 15, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 7,
107
- .type = ARM_CP_NO_RAW, .access = PL1_W, .accessfn = access_ttlb,
108
+ .type = ARM_CP_NO_RAW, .access = PL1_W, .accessfn = access_ttlbis,
109
.writefn = tlbimvaa_is_write },
110
{ .name = "TLBIMVAL", .cp = 15, .opc1 = 0, .crn = 8, .crm = 7, .opc2 = 5,
111
.type = ARM_CP_NO_RAW, .access = PL1_W, .accessfn = access_ttlb,
112
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo pauth_reginfo[] = {
113
static const ARMCPRegInfo tlbirange_reginfo[] = {
114
{ .name = "TLBI_RVAE1IS", .state = ARM_CP_STATE_AA64,
115
.opc0 = 1, .opc1 = 0, .crn = 8, .crm = 2, .opc2 = 1,
116
- .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW,
117
+ .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW,
118
.writefn = tlbi_aa64_rvae1is_write },
119
{ .name = "TLBI_RVAAE1IS", .state = ARM_CP_STATE_AA64,
120
.opc0 = 1, .opc1 = 0, .crn = 8, .crm = 2, .opc2 = 3,
121
- .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW,
122
+ .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW,
123
.writefn = tlbi_aa64_rvae1is_write },
124
{ .name = "TLBI_RVALE1IS", .state = ARM_CP_STATE_AA64,
125
.opc0 = 1, .opc1 = 0, .crn = 8, .crm = 2, .opc2 = 5,
126
- .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW,
127
+ .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW,
128
.writefn = tlbi_aa64_rvae1is_write },
129
{ .name = "TLBI_RVAALE1IS", .state = ARM_CP_STATE_AA64,
130
.opc0 = 1, .opc1 = 0, .crn = 8, .crm = 2, .opc2 = 7,
131
- .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW,
132
+ .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW,
133
.writefn = tlbi_aa64_rvae1is_write },
134
{ .name = "TLBI_RVAE1OS", .state = ARM_CP_STATE_AA64,
135
.opc0 = 1, .opc1 = 0, .crn = 8, .crm = 5, .opc2 = 1,
74
--
136
--
75
2.25.1
137
2.25.1
76
77
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
For FEAT_EVT, the HCR_EL2.TTLBOS bit allows trapping on EL1
2
use of TLB maintenance instructions that operate on the
3
outer shareable domain:
2
4
3
The TYPE_ARM_GICV3 device is an emulated one. When using
5
TLBI VMALLE1OS, TLBI VAE1OS, TLBI ASIDE1OS,TLBI VAAE1OS,
4
KVM, it is recommended to use the TYPE_KVM_ARM_GICV3 device
6
TLBI VALE1OS, TLBI VAALE1OS, TLBI RVAE1OS, TLBI RVAAE1OS,
5
(which uses in-kernel support).
7
TLBI RVALE1OS, and TLBI RVAALE1OS.
6
8
7
When using --with-devices-FOO, it is possible to build a
9
(There are no AArch32 outer-shareable TLB maintenance ops.)
8
binary with a specific set of devices. When this binary is
9
restricted to KVM accelerator, the TYPE_ARM_GICV3 device is
10
irrelevant, and it is desirable to remove it from the binary.
11
10
12
Therefore introduce the CONFIG_ARM_GIC_TCG Kconfig selector
11
Implement the trapping.
13
which select the files required to have the TYPE_ARM_GICV3
14
device, but also allowing to de-select this device.
15
12
16
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
17
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
18
Message-id: 20211115223619.2599282-3-philmd@redhat.com
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
20
---
15
---
21
hw/intc/arm_gicv3.c | 2 +-
16
target/arm/helper.c | 33 +++++++++++++++++++++++----------
22
hw/intc/Kconfig | 5 +++++
17
1 file changed, 23 insertions(+), 10 deletions(-)
23
hw/intc/meson.build | 10 ++++++----
24
3 files changed, 12 insertions(+), 5 deletions(-)
25
18
26
diff --git a/hw/intc/arm_gicv3.c b/hw/intc/arm_gicv3.c
19
diff --git a/target/arm/helper.c b/target/arm/helper.c
27
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
28
--- a/hw/intc/arm_gicv3.c
21
--- a/target/arm/helper.c
29
+++ b/hw/intc/arm_gicv3.c
22
+++ b/target/arm/helper.c
30
@@ -XXX,XX +XXX,XX @@
23
@@ -XXX,XX +XXX,XX @@ static CPAccessResult access_ttlbis(CPUARMState *env, const ARMCPRegInfo *ri,
31
/*
24
return CP_ACCESS_OK;
32
- * ARM Generic Interrupt Controller v3
25
}
33
+ * ARM Generic Interrupt Controller v3 (emulation)
26
34
*
27
+#ifdef TARGET_AARCH64
35
* Copyright (c) 2015 Huawei.
28
+/* Check for traps from EL1 due to HCR_EL2.TTLB or TTLBOS. */
36
* Copyright (c) 2016 Linaro Limited
29
+static CPAccessResult access_ttlbos(CPUARMState *env, const ARMCPRegInfo *ri,
37
diff --git a/hw/intc/Kconfig b/hw/intc/Kconfig
30
+ bool isread)
38
index XXXXXXX..XXXXXXX 100644
31
+{
39
--- a/hw/intc/Kconfig
32
+ if (arm_current_el(env) == 1 &&
40
+++ b/hw/intc/Kconfig
33
+ (arm_hcr_el2_eff(env) & (HCR_TTLB | HCR_TTLBOS))) {
41
@@ -XXX,XX +XXX,XX @@ config APIC
34
+ return CP_ACCESS_TRAP_EL2;
42
select MSI_NONBROKEN
35
+ }
43
select I8259
36
+ return CP_ACCESS_OK;
44
37
+}
45
+config ARM_GIC_TCG
38
+#endif
46
+ bool
47
+ default y
48
+ depends on ARM_GIC && TCG
49
+
39
+
50
config ARM_GIC_KVM
40
static void dacr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)
51
bool
41
{
52
default y
42
ARMCPU *cpu = env_archcpu(env);
53
diff --git a/hw/intc/meson.build b/hw/intc/meson.build
43
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo tlbirange_reginfo[] = {
54
index XXXXXXX..XXXXXXX 100644
44
.writefn = tlbi_aa64_rvae1is_write },
55
--- a/hw/intc/meson.build
45
{ .name = "TLBI_RVAE1OS", .state = ARM_CP_STATE_AA64,
56
+++ b/hw/intc/meson.build
46
.opc0 = 1, .opc1 = 0, .crn = 8, .crm = 5, .opc2 = 1,
57
@@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_ARM_GIC', if_true: files(
47
- .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW,
58
'arm_gic.c',
48
+ .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW,
59
'arm_gic_common.c',
49
.writefn = tlbi_aa64_rvae1is_write },
60
'arm_gicv2m.c',
50
{ .name = "TLBI_RVAAE1OS", .state = ARM_CP_STATE_AA64,
61
- 'arm_gicv3.c',
51
.opc0 = 1, .opc1 = 0, .crn = 8, .crm = 5, .opc2 = 3,
62
'arm_gicv3_common.c',
52
- .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW,
63
- 'arm_gicv3_dist.c',
53
+ .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW,
64
'arm_gicv3_its_common.c',
54
.writefn = tlbi_aa64_rvae1is_write },
65
- 'arm_gicv3_redist.c',
55
{ .name = "TLBI_RVALE1OS", .state = ARM_CP_STATE_AA64,
66
+))
56
.opc0 = 1, .opc1 = 0, .crn = 8, .crm = 5, .opc2 = 5,
67
+softmmu_ss.add(when: 'CONFIG_ARM_GIC_TCG', if_true: files(
57
- .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW,
68
+ 'arm_gicv3.c',
58
+ .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW,
69
+ 'arm_gicv3_dist.c',
59
.writefn = tlbi_aa64_rvae1is_write },
70
'arm_gicv3_its.c',
60
{ .name = "TLBI_RVAALE1OS", .state = ARM_CP_STATE_AA64,
71
+ 'arm_gicv3_redist.c',
61
.opc0 = 1, .opc1 = 0, .crn = 8, .crm = 5, .opc2 = 7,
72
))
62
- .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW,
73
softmmu_ss.add(when: 'CONFIG_ETRAXFS', if_true: files('etraxfs_pic.c'))
63
+ .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW,
74
softmmu_ss.add(when: 'CONFIG_HEATHROW_PIC', if_true: files('heathrow_pic.c'))
64
.writefn = tlbi_aa64_rvae1is_write },
75
@@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_XLNX_ZYNQMP_PMU', if_true: files('xlnx-pmu-iomod-in
65
{ .name = "TLBI_RVAE1", .state = ARM_CP_STATE_AA64,
76
specific_ss.add(when: 'CONFIG_ALLWINNER_A10_PIC', if_true: files('allwinner-a10-pic.c'))
66
.opc0 = 1, .opc1 = 0, .crn = 8, .crm = 6, .opc2 = 1,
77
specific_ss.add(when: 'CONFIG_APIC', if_true: files('apic.c', 'apic_common.c'))
67
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo tlbirange_reginfo[] = {
78
specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif_common.c'))
68
static const ARMCPRegInfo tlbios_reginfo[] = {
79
-specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif.c'))
69
{ .name = "TLBI_VMALLE1OS", .state = ARM_CP_STATE_AA64,
80
+specific_ss.add(when: 'CONFIG_ARM_GIC_TCG', if_true: files('arm_gicv3_cpuif.c'))
70
.opc0 = 1, .opc1 = 0, .crn = 8, .crm = 1, .opc2 = 0,
81
specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gic_kvm.c'))
71
- .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW,
82
specific_ss.add(when: ['CONFIG_ARM_GIC_KVM', 'TARGET_AARCH64'], if_true: files('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c'))
72
+ .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW,
83
specific_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('armv7m_nvic.c'))
73
.writefn = tlbi_aa64_vmalle1is_write },
74
{ .name = "TLBI_VAE1OS", .state = ARM_CP_STATE_AA64,
75
.opc0 = 1, .opc1 = 0, .crn = 8, .crm = 1, .opc2 = 1,
76
- .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW,
77
+ .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW,
78
.writefn = tlbi_aa64_vae1is_write },
79
{ .name = "TLBI_ASIDE1OS", .state = ARM_CP_STATE_AA64,
80
.opc0 = 1, .opc1 = 0, .crn = 8, .crm = 1, .opc2 = 2,
81
- .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW,
82
+ .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW,
83
.writefn = tlbi_aa64_vmalle1is_write },
84
{ .name = "TLBI_VAAE1OS", .state = ARM_CP_STATE_AA64,
85
.opc0 = 1, .opc1 = 0, .crn = 8, .crm = 1, .opc2 = 3,
86
- .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW,
87
+ .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW,
88
.writefn = tlbi_aa64_vae1is_write },
89
{ .name = "TLBI_VALE1OS", .state = ARM_CP_STATE_AA64,
90
.opc0 = 1, .opc1 = 0, .crn = 8, .crm = 1, .opc2 = 5,
91
- .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW,
92
+ .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW,
93
.writefn = tlbi_aa64_vae1is_write },
94
{ .name = "TLBI_VAALE1OS", .state = ARM_CP_STATE_AA64,
95
.opc0 = 1, .opc1 = 0, .crn = 8, .crm = 1, .opc2 = 7,
96
- .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW,
97
+ .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW,
98
.writefn = tlbi_aa64_vae1is_write },
99
{ .name = "TLBI_ALLE2OS", .state = ARM_CP_STATE_AA64,
100
.opc0 = 1, .opc1 = 4, .crn = 8, .crm = 1, .opc2 = 0,
84
--
101
--
85
2.25.1
102
2.25.1
86
87
diff view generated by jsdifflib
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
1
For FEAT_EVT, the HCR_EL2.TICAB bit allows trapping of the ICIALLUIS
2
and IC IALLUIS cache maintenance instructions.
2
3
3
Add two test cases for VIOT, one on the q35 machine and the other on
4
The HCR_EL2.TOCU bit traps all the other cache maintenance
4
virt. To test complex topologies the q35 test has two PCIe buses that
5
instructions that operate to the point of unification:
5
bypass the IOMMU (and are therefore not described by VIOT), and two
6
AArch64 IC IVAU, IC IALLU, DC CVAU
6
buses that are translated by virtio-iommu.
7
AArch32 ICIMVAU, ICIALLU, DCCMVAU
7
8
8
Reviewed-by: Eric Auger <eric.auger@redhat.com>
9
The two trap bits between them cover all of the cache maintenance
9
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
10
instructions which must also check the HCR_TPU flag. Turn the old
10
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
11
aa64_cacheop_pou_access() function into a helper function which takes
11
Message-id: 20211210170415.583179-7-jean-philippe@linaro.org
12
the set of HCR_EL2 flags to check as an argument, and call it from
13
new access_ticab() and access_tocu() functions as appropriate for
14
each cache op.
15
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
13
---
18
---
14
tests/qtest/bios-tables-test.c | 38 ++++++++++++++++++++++++++++++++++
19
target/arm/helper.c | 36 +++++++++++++++++++++++-------------
15
1 file changed, 38 insertions(+)
20
1 file changed, 23 insertions(+), 13 deletions(-)
16
21
17
diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
22
diff --git a/target/arm/helper.c b/target/arm/helper.c
18
index XXXXXXX..XXXXXXX 100644
23
index XXXXXXX..XXXXXXX 100644
19
--- a/tests/qtest/bios-tables-test.c
24
--- a/target/arm/helper.c
20
+++ b/tests/qtest/bios-tables-test.c
25
+++ b/target/arm/helper.c
21
@@ -XXX,XX +XXX,XX @@ static void test_acpi_virt_tcg(void)
26
@@ -XXX,XX +XXX,XX @@ static CPAccessResult aa64_cacheop_poc_access(CPUARMState *env,
22
free_test_data(&data);
27
return CP_ACCESS_OK;
23
}
28
}
24
29
25
+static void test_acpi_q35_viot(void)
30
-static CPAccessResult aa64_cacheop_pou_access(CPUARMState *env,
31
- const ARMCPRegInfo *ri,
32
- bool isread)
33
+static CPAccessResult do_cacheop_pou_access(CPUARMState *env, uint64_t hcrflags)
34
{
35
/* Cache invalidate/clean to Point of Unification... */
36
switch (arm_current_el(env)) {
37
@@ -XXX,XX +XXX,XX @@ static CPAccessResult aa64_cacheop_pou_access(CPUARMState *env,
38
}
39
/* fall through */
40
case 1:
41
- /* ... EL1 must trap to EL2 if HCR_EL2.TPU is set. */
42
- if (arm_hcr_el2_eff(env) & HCR_TPU) {
43
+ /* ... EL1 must trap to EL2 if relevant HCR_EL2 flags are set. */
44
+ if (arm_hcr_el2_eff(env) & hcrflags) {
45
return CP_ACCESS_TRAP_EL2;
46
}
47
break;
48
@@ -XXX,XX +XXX,XX @@ static CPAccessResult aa64_cacheop_pou_access(CPUARMState *env,
49
return CP_ACCESS_OK;
50
}
51
52
+static CPAccessResult access_ticab(CPUARMState *env, const ARMCPRegInfo *ri,
53
+ bool isread)
26
+{
54
+{
27
+ test_data data = {
55
+ return do_cacheop_pou_access(env, HCR_TICAB | HCR_TPU);
28
+ .machine = MACHINE_Q35,
29
+ .variant = ".viot",
30
+ };
31
+
32
+ /*
33
+ * To keep things interesting, two buses bypass the IOMMU.
34
+ * VIOT should only describes the other two buses.
35
+ */
36
+ test_acpi_one("-machine default_bus_bypass_iommu=on "
37
+ "-device virtio-iommu-pci "
38
+ "-device pxb-pcie,bus_nr=0x10,id=pcie.100,bus=pcie.0 "
39
+ "-device pxb-pcie,bus_nr=0x20,id=pcie.200,bus=pcie.0,bypass_iommu=on "
40
+ "-device pxb-pcie,bus_nr=0x30,id=pcie.300,bus=pcie.0",
41
+ &data);
42
+ free_test_data(&data);
43
+}
56
+}
44
+
57
+
45
+static void test_acpi_virt_viot(void)
58
+static CPAccessResult access_tocu(CPUARMState *env, const ARMCPRegInfo *ri,
59
+ bool isread)
46
+{
60
+{
47
+ test_data data = {
61
+ return do_cacheop_pou_access(env, HCR_TOCU | HCR_TPU);
48
+ .machine = "virt",
49
+ .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
50
+ .uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
51
+ .cd = "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2",
52
+ .ram_start = 0x40000000ULL,
53
+ .scan_len = 128ULL * 1024 * 1024,
54
+ };
55
+
56
+ test_acpi_one("-cpu cortex-a57 "
57
+ "-device virtio-iommu-pci", &data);
58
+ free_test_data(&data);
59
+}
62
+}
60
+
63
+
61
static void test_oem_fields(test_data *data)
64
/* See: D4.7.2 TLB maintenance requirements and the TLB maintenance instructions
62
{
65
* Page D4-1736 (DDI0487A.b)
63
int i;
66
*/
64
@@ -XXX,XX +XXX,XX @@ int main(int argc, char *argv[])
67
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
65
qtest_add_func("acpi/q35/kvm/xapic", test_acpi_q35_kvm_xapic);
68
{ .name = "IC_IALLUIS", .state = ARM_CP_STATE_AA64,
66
qtest_add_func("acpi/q35/kvm/dmar", test_acpi_q35_kvm_dmar);
69
.opc0 = 1, .opc1 = 0, .crn = 7, .crm = 1, .opc2 = 0,
67
}
70
.access = PL1_W, .type = ARM_CP_NOP,
68
+ qtest_add_func("acpi/q35/viot", test_acpi_q35_viot);
71
- .accessfn = aa64_cacheop_pou_access },
69
} else if (strcmp(arch, "aarch64") == 0) {
72
+ .accessfn = access_ticab },
70
if (has_tcg) {
73
{ .name = "IC_IALLU", .state = ARM_CP_STATE_AA64,
71
qtest_add_func("acpi/virt", test_acpi_virt_tcg);
74
.opc0 = 1, .opc1 = 0, .crn = 7, .crm = 5, .opc2 = 0,
72
@@ -XXX,XX +XXX,XX @@ int main(int argc, char *argv[])
75
.access = PL1_W, .type = ARM_CP_NOP,
73
qtest_add_func("acpi/virt/memhp", test_acpi_virt_tcg_memhp);
76
- .accessfn = aa64_cacheop_pou_access },
74
qtest_add_func("acpi/virt/pxb", test_acpi_virt_tcg_pxb);
77
+ .accessfn = access_tocu },
75
qtest_add_func("acpi/virt/oem-fields", test_acpi_oem_fields_virt);
78
{ .name = "IC_IVAU", .state = ARM_CP_STATE_AA64,
76
+ qtest_add_func("acpi/virt/viot", test_acpi_virt_viot);
79
.opc0 = 1, .opc1 = 3, .crn = 7, .crm = 5, .opc2 = 1,
77
}
80
.access = PL0_W, .type = ARM_CP_NOP,
78
}
81
- .accessfn = aa64_cacheop_pou_access },
79
ret = g_test_run();
82
+ .accessfn = access_tocu },
83
{ .name = "DC_IVAC", .state = ARM_CP_STATE_AA64,
84
.opc0 = 1, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 1,
85
.access = PL1_W, .accessfn = aa64_cacheop_poc_access,
86
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
87
{ .name = "DC_CVAU", .state = ARM_CP_STATE_AA64,
88
.opc0 = 1, .opc1 = 3, .crn = 7, .crm = 11, .opc2 = 1,
89
.access = PL0_W, .type = ARM_CP_NOP,
90
- .accessfn = aa64_cacheop_pou_access },
91
+ .accessfn = access_tocu },
92
{ .name = "DC_CIVAC", .state = ARM_CP_STATE_AA64,
93
.opc0 = 1, .opc1 = 3, .crn = 7, .crm = 14, .opc2 = 1,
94
.access = PL0_W, .type = ARM_CP_NOP,
95
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
96
.writefn = tlbiipas2is_hyp_write },
97
/* 32 bit cache operations */
98
{ .name = "ICIALLUIS", .cp = 15, .opc1 = 0, .crn = 7, .crm = 1, .opc2 = 0,
99
- .type = ARM_CP_NOP, .access = PL1_W, .accessfn = aa64_cacheop_pou_access },
100
+ .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_ticab },
101
{ .name = "BPIALLUIS", .cp = 15, .opc1 = 0, .crn = 7, .crm = 1, .opc2 = 6,
102
.type = ARM_CP_NOP, .access = PL1_W },
103
{ .name = "ICIALLU", .cp = 15, .opc1 = 0, .crn = 7, .crm = 5, .opc2 = 0,
104
- .type = ARM_CP_NOP, .access = PL1_W, .accessfn = aa64_cacheop_pou_access },
105
+ .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tocu },
106
{ .name = "ICIMVAU", .cp = 15, .opc1 = 0, .crn = 7, .crm = 5, .opc2 = 1,
107
- .type = ARM_CP_NOP, .access = PL1_W, .accessfn = aa64_cacheop_pou_access },
108
+ .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tocu },
109
{ .name = "BPIALL", .cp = 15, .opc1 = 0, .crn = 7, .crm = 5, .opc2 = 6,
110
.type = ARM_CP_NOP, .access = PL1_W },
111
{ .name = "BPIMVA", .cp = 15, .opc1 = 0, .crn = 7, .crm = 5, .opc2 = 7,
112
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
113
{ .name = "DCCSW", .cp = 15, .opc1 = 0, .crn = 7, .crm = 10, .opc2 = 2,
114
.type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw },
115
{ .name = "DCCMVAU", .cp = 15, .opc1 = 0, .crn = 7, .crm = 11, .opc2 = 1,
116
- .type = ARM_CP_NOP, .access = PL1_W, .accessfn = aa64_cacheop_pou_access },
117
+ .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tocu },
118
{ .name = "DCCIMVAC", .cp = 15, .opc1 = 0, .crn = 7, .crm = 14, .opc2 = 1,
119
.type = ARM_CP_NOP, .access = PL1_W, .accessfn = aa64_cacheop_poc_access },
120
{ .name = "DCCISW", .cp = 15, .opc1 = 0, .crn = 7, .crm = 14, .opc2 = 2,
80
--
121
--
81
2.25.1
122
2.25.1
82
83
diff view generated by jsdifflib
1
The calculation of the length of TLB range invalidate operations
1
For FEAT_EVT, the HCR_EL2.TID4 trap allows trapping of the cache ID
2
in tlbi_aa64_range_get_length() is incorrect in two ways:
2
registers CCSIDR_EL1, CCSIDR2_EL1, CLIDR_EL1 and CSSELR_EL1 (and
3
* the NUM field is 5 bits, but we read only 4 bits
3
their AArch32 equivalents). This is a subset of the registers
4
* we miscalculate the page_shift value, because of an
4
trapped by HCR_EL2.TID2, which includes all of these and also the
5
off-by-one error:
5
CTR_EL0 register.
6
TG 0b00 is invalid
7
TG 0b01 is 4K granule size == 4096 == 2^12
8
TG 0b10 is 16K granule size == 16384 == 2^14
9
TG 0b11 is 64K granule size == 65536 == 2^16
10
so page_shift should be (TG - 1) * 2 + 12
11
6
12
Thanks to the bug report submitter Cha HyunSoo for identifying
7
Our implementation already uses a separate access function for
13
both these errors.
8
CTR_EL0 (ctr_el0_access()), so all of the registers currently using
9
access_aa64_tid2() should also be checking TID4. Make that function
10
check both TID2 and TID4, and rename it appropriately.
14
11
15
Fixes: 84940ed82552d3c ("target/arm: Add support for FEAT_TLBIRANGE")
16
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/734
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
19
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
20
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
21
Message-id: 20211130173257.1274194-1-peter.maydell@linaro.org
22
---
14
---
23
target/arm/helper.c | 6 +++---
15
target/arm/helper.c | 17 +++++++++--------
24
1 file changed, 3 insertions(+), 3 deletions(-)
16
1 file changed, 9 insertions(+), 8 deletions(-)
25
17
26
diff --git a/target/arm/helper.c b/target/arm/helper.c
18
diff --git a/target/arm/helper.c b/target/arm/helper.c
27
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
28
--- a/target/arm/helper.c
20
--- a/target/arm/helper.c
29
+++ b/target/arm/helper.c
21
+++ b/target/arm/helper.c
30
@@ -XXX,XX +XXX,XX @@ static uint64_t tlbi_aa64_range_get_length(CPUARMState *env,
22
@@ -XXX,XX +XXX,XX @@ static void scr_reset(CPUARMState *env, const ARMCPRegInfo *ri)
31
uint64_t exponent;
23
scr_write(env, ri, 0);
32
uint64_t length;
24
}
33
25
34
- num = extract64(value, 39, 4);
26
-static CPAccessResult access_aa64_tid2(CPUARMState *env,
35
+ num = extract64(value, 39, 5);
27
- const ARMCPRegInfo *ri,
36
scale = extract64(value, 44, 2);
28
- bool isread)
37
page_size_granule = extract64(value, 46, 2);
29
+static CPAccessResult access_tid4(CPUARMState *env,
38
30
+ const ARMCPRegInfo *ri,
39
- page_shift = page_size_granule * 2 + 12;
31
+ bool isread)
40
-
32
{
41
if (page_size_granule == 0) {
33
- if (arm_current_el(env) == 1 && (arm_hcr_el2_eff(env) & HCR_TID2)) {
42
qemu_log_mask(LOG_GUEST_ERROR, "Invalid page size granule %d\n",
34
+ if (arm_current_el(env) == 1 &&
43
page_size_granule);
35
+ (arm_hcr_el2_eff(env) & (HCR_TID2 | HCR_TID4))) {
44
return 0;
36
return CP_ACCESS_TRAP_EL2;
45
}
37
}
46
38
47
+ page_shift = (page_size_granule - 1) * 2 + 12;
39
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = {
48
+
40
{ .name = "CCSIDR", .state = ARM_CP_STATE_BOTH,
49
exponent = (5 * scale) + 1;
41
.opc0 = 3, .crn = 0, .crm = 0, .opc1 = 1, .opc2 = 0,
50
length = (num + 1) << (exponent + page_shift);
42
.access = PL1_R,
51
43
- .accessfn = access_aa64_tid2,
44
+ .accessfn = access_tid4,
45
.readfn = ccsidr_read, .type = ARM_CP_NO_RAW },
46
{ .name = "CSSELR", .state = ARM_CP_STATE_BOTH,
47
.opc0 = 3, .crn = 0, .crm = 0, .opc1 = 2, .opc2 = 0,
48
.access = PL1_RW,
49
- .accessfn = access_aa64_tid2,
50
+ .accessfn = access_tid4,
51
.writefn = csselr_write, .resetvalue = 0,
52
.bank_fieldoffsets = { offsetof(CPUARMState, cp15.csselr_s),
53
offsetof(CPUARMState, cp15.csselr_ns) } },
54
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo ccsidr2_reginfo[] = {
55
{ .name = "CCSIDR2", .state = ARM_CP_STATE_BOTH,
56
.opc0 = 3, .opc1 = 1, .crn = 0, .crm = 0, .opc2 = 2,
57
.access = PL1_R,
58
- .accessfn = access_aa64_tid2,
59
+ .accessfn = access_tid4,
60
.readfn = ccsidr2_read, .type = ARM_CP_NO_RAW },
61
};
62
63
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
64
.name = "CLIDR", .state = ARM_CP_STATE_BOTH,
65
.opc0 = 3, .crn = 0, .crm = 0, .opc1 = 1, .opc2 = 1,
66
.access = PL1_R, .type = ARM_CP_CONST,
67
- .accessfn = access_aa64_tid2,
68
+ .accessfn = access_tid4,
69
.resetvalue = cpu->clidr
70
};
71
define_one_arm_cp_reg(cpu, &clidr);
52
--
72
--
53
2.25.1
73
2.25.1
54
55
diff view generated by jsdifflib
1
In the SSE decode function gen_sse(), we combine a byte
1
Update the ID registers for TCG's '-cpu max' to report the
2
'b' and a value 'b1' which can be [0..3], and switch on them:
2
FEAT_EVT Enhanced Virtualization Traps support.
3
b |= (b1 << 8);
4
switch (b) {
5
...
6
default:
7
unknown_op:
8
gen_unknown_opcode(env, s);
9
return;
10
}
11
3
12
In three cases inside this switch, we were then also checking for
13
"if (b1 >= 2) { goto unknown_op; }".
14
However, this can never happen, because the 'case' values in each place
15
are 0x0nn or 0x1nn and the switch will have directed the b1 == (2, 3)
16
cases to the default already.
17
18
This check was added in commit c045af25a52e9 in 2010; the added code
19
was unnecessary then as well, and was apparently intended only to
20
ensure that we never accidentally ended up indexing off the end
21
of an sse_op_table with only 2 entries as a result of future bugs
22
in the decode logic.
23
24
Change the checks to assert() instead, and make sure they're always
25
immediately before the array access they are protecting.
26
27
Fixes: Coverity CID 1460207
28
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
29
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
30
---
6
---
31
target/i386/tcg/translate.c | 12 +++---------
7
docs/system/arm/emulation.rst | 1 +
32
1 file changed, 3 insertions(+), 9 deletions(-)
8
target/arm/cpu64.c | 1 +
9
target/arm/cpu_tcg.c | 1 +
10
3 files changed, 3 insertions(+)
33
11
34
diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
12
diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst
35
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
36
--- a/target/i386/tcg/translate.c
14
--- a/docs/system/arm/emulation.rst
37
+++ b/target/i386/tcg/translate.c
15
+++ b/docs/system/arm/emulation.rst
38
@@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b,
16
@@ -XXX,XX +XXX,XX @@ the following architecture extensions:
39
case 0x171: /* shift xmm, im */
17
- FEAT_DoubleFault (Double Fault Extension)
40
case 0x172:
18
- FEAT_E0PD (Preventing EL0 access to halves of address maps)
41
case 0x173:
19
- FEAT_ETS (Enhanced Translation Synchronization)
42
- if (b1 >= 2) {
20
+- FEAT_EVT (Enhanced Virtualization Traps)
43
- goto unknown_op;
21
- FEAT_FCMA (Floating-point complex number instructions)
44
- }
22
- FEAT_FHM (Floating-point half-precision multiplication instructions)
45
val = x86_ldub_code(env, s);
23
- FEAT_FP16 (Half-precision floating-point data processing)
46
if (is_xmm) {
24
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
47
tcg_gen_movi_tl(s->T0, val);
25
index XXXXXXX..XXXXXXX 100644
48
@@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b,
26
--- a/target/arm/cpu64.c
49
offsetof(CPUX86State, mmx_t0.MMX_L(1)));
27
+++ b/target/arm/cpu64.c
50
op1_offset = offsetof(CPUX86State,mmx_t0);
28
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
51
}
29
t = FIELD_DP64(t, ID_AA64MMFR2, FWB, 1); /* FEAT_S2FWB */
52
+ assert(b1 < 2);
30
t = FIELD_DP64(t, ID_AA64MMFR2, TTL, 1); /* FEAT_TTL */
53
sse_fn_epp = sse_op_table2[((b - 1) & 3) * 8 +
31
t = FIELD_DP64(t, ID_AA64MMFR2, BBM, 2); /* FEAT_BBM at level 2 */
54
(((modrm >> 3)) & 7)][b1];
32
+ t = FIELD_DP64(t, ID_AA64MMFR2, EVT, 2); /* FEAT_EVT */
55
if (!sse_fn_epp) {
33
t = FIELD_DP64(t, ID_AA64MMFR2, E0PD, 1); /* FEAT_E0PD */
56
@@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b,
34
cpu->isar.id_aa64mmfr2 = t;
57
rm = modrm & 7;
35
58
reg = ((modrm >> 3) & 7) | REX_R(s);
36
diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c
59
mod = (modrm >> 6) & 3;
37
index XXXXXXX..XXXXXXX 100644
60
- if (b1 >= 2) {
38
--- a/target/arm/cpu_tcg.c
61
- goto unknown_op;
39
+++ b/target/arm/cpu_tcg.c
62
- }
40
@@ -XXX,XX +XXX,XX @@ void aa32_max_features(ARMCPU *cpu)
63
41
t = FIELD_DP32(t, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */
64
+ assert(b1 < 2);
42
t = FIELD_DP32(t, ID_MMFR4, CNP, 1); /* FEAT_TTCNP */
65
sse_fn_epp = sse_op_table6[b].op[b1];
43
t = FIELD_DP32(t, ID_MMFR4, XNX, 1); /* FEAT_XNX */
66
if (!sse_fn_epp) {
44
+ t = FIELD_DP32(t, ID_MMFR4, EVT, 2); /* FEAT_EVT */
67
goto unknown_op;
45
cpu->isar.id_mmfr4 = t;
68
@@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b,
46
69
rm = modrm & 7;
47
t = cpu->isar.id_mmfr5;
70
reg = ((modrm >> 3) & 7) | REX_R(s);
71
mod = (modrm >> 6) & 3;
72
- if (b1 >= 2) {
73
- goto unknown_op;
74
- }
75
76
+ assert(b1 < 2);
77
sse_fn_eppi = sse_op_table7[b].op[b1];
78
if (!sse_fn_eppi) {
79
goto unknown_op;
80
--
48
--
81
2.25.1
49
2.25.1
82
83
diff view generated by jsdifflib
1
From: Patrick Venture <venture@google.com>
1
Convert the TYPE_ARM_SMMU device to 3-phase reset. The legacy method
2
doesn't do anything that's invalid in the hold phase, so the
3
conversion is simple and not a behaviour change.
2
4
3
The rx_active boolean change to true should always trigger a try_read
5
Note that we must convert this base class before we can convert the
4
call that flushes the queue.
6
TYPE_ARM_SMMUV3 subclass -- transitional support in Resettable
7
handles "chain to parent class reset" when the base class is 3-phase
8
and the subclass is still using legacy reset, but not the other way
9
around.
5
10
6
Signed-off-by: Patrick Venture <venture@google.com>
7
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
Message-id: 20211203221002.1719306-1-venture@google.com
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Reviewed-by: Eric Auger <eric.auger@redhat.com>
15
Message-id: 20221109161444.3397405-2-peter.maydell@linaro.org
10
---
16
---
11
hw/net/npcm7xx_emc.c | 18 ++++++++----------
17
hw/arm/smmu-common.c | 7 ++++---
12
1 file changed, 8 insertions(+), 10 deletions(-)
18
1 file changed, 4 insertions(+), 3 deletions(-)
13
19
14
diff --git a/hw/net/npcm7xx_emc.c b/hw/net/npcm7xx_emc.c
20
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
15
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/net/npcm7xx_emc.c
22
--- a/hw/arm/smmu-common.c
17
+++ b/hw/net/npcm7xx_emc.c
23
+++ b/hw/arm/smmu-common.c
18
@@ -XXX,XX +XXX,XX @@ static void emc_halt_rx(NPCM7xxEMCState *emc, uint32_t mista_flag)
24
@@ -XXX,XX +XXX,XX @@ static void smmu_base_realize(DeviceState *dev, Error **errp)
19
emc_set_mista(emc, mista_flag);
25
}
20
}
26
}
21
27
22
+static void emc_enable_rx_and_flush(NPCM7xxEMCState *emc)
28
-static void smmu_base_reset(DeviceState *dev)
23
+{
29
+static void smmu_base_reset_hold(Object *obj)
24
+ emc->rx_active = true;
30
{
25
+ qemu_flush_queued_packets(qemu_get_queue(emc->nic));
31
- SMMUState *s = ARM_SMMU(dev);
26
+}
32
+ SMMUState *s = ARM_SMMU(obj);
27
+
33
28
static void emc_set_next_tx_descriptor(NPCM7xxEMCState *emc,
34
g_hash_table_remove_all(s->configs);
29
const NPCM7xxEMCTxDesc *tx_desc,
35
g_hash_table_remove_all(s->iotlb);
30
uint32_t desc_addr)
36
@@ -XXX,XX +XXX,XX @@ static Property smmu_dev_properties[] = {
31
@@ -XXX,XX +XXX,XX @@ static ssize_t emc_receive(NetClientState *nc, const uint8_t *buf, size_t len1)
37
static void smmu_base_class_init(ObjectClass *klass, void *data)
32
return len;
38
{
39
DeviceClass *dc = DEVICE_CLASS(klass);
40
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
41
SMMUBaseClass *sbc = ARM_SMMU_CLASS(klass);
42
43
device_class_set_props(dc, smmu_dev_properties);
44
device_class_set_parent_realize(dc, smmu_base_realize,
45
&sbc->parent_realize);
46
- dc->reset = smmu_base_reset;
47
+ rc->phases.hold = smmu_base_reset_hold;
33
}
48
}
34
49
35
-static void emc_try_receive_next_packet(NPCM7xxEMCState *emc)
50
static const TypeInfo smmu_base_info = {
36
-{
37
- if (emc_can_receive(qemu_get_queue(emc->nic))) {
38
- qemu_flush_queued_packets(qemu_get_queue(emc->nic));
39
- }
40
-}
41
-
42
static uint64_t npcm7xx_emc_read(void *opaque, hwaddr offset, unsigned size)
43
{
44
NPCM7xxEMCState *emc = opaque;
45
@@ -XXX,XX +XXX,XX @@ static void npcm7xx_emc_write(void *opaque, hwaddr offset,
46
emc->regs[REG_MGSTA] |= REG_MGSTA_RXHA;
47
}
48
if (value & REG_MCMDR_RXON) {
49
- emc->rx_active = true;
50
+ emc_enable_rx_and_flush(emc);
51
} else {
52
emc_halt_rx(emc, 0);
53
}
54
@@ -XXX,XX +XXX,XX @@ static void npcm7xx_emc_write(void *opaque, hwaddr offset,
55
break;
56
case REG_RSDR:
57
if (emc->regs[REG_MCMDR] & REG_MCMDR_RXON) {
58
- emc->rx_active = true;
59
- emc_try_receive_next_packet(emc);
60
+ emc_enable_rx_and_flush(emc);
61
}
62
break;
63
case REG_MIIDA:
64
--
51
--
65
2.25.1
52
2.25.1
66
53
67
54
diff view generated by jsdifflib
1
The qemu-common.h header is not supposed to be included from any
1
Convert the TYPE_ARM_SMMUV3 device to 3-phase reset. The legacy
2
other header files, only from .c files (as documented in a comment at
2
reset method doesn't do anything that's invalid in the hold phase, so
3
the start of it).
3
the conversion only requires changing it to a hold phase method, and
4
4
using the 3-phase versions of the "save the parent reset method and
5
include/hw/i386/x86.h and include/hw/i386/microvm.h break this rule.
5
chain to it" code.
6
In fact, the include is not required at all, so we can just drop it
7
from both files.
8
6
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Reviewed-by: Eric Auger <eric.auger@redhat.com>
12
Message-id: 20211129200510.1233037-2-peter.maydell@linaro.org
10
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
Message-id: 20221109161444.3397405-3-peter.maydell@linaro.org
13
---
12
---
14
include/hw/i386/microvm.h | 1 -
13
include/hw/arm/smmuv3.h | 2 +-
15
include/hw/i386/x86.h | 1 -
14
hw/arm/smmuv3.c | 12 ++++++++----
16
2 files changed, 2 deletions(-)
15
2 files changed, 9 insertions(+), 5 deletions(-)
17
16
18
diff --git a/include/hw/i386/microvm.h b/include/hw/i386/microvm.h
17
diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h
19
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
20
--- a/include/hw/i386/microvm.h
19
--- a/include/hw/arm/smmuv3.h
21
+++ b/include/hw/i386/microvm.h
20
+++ b/include/hw/arm/smmuv3.h
22
@@ -XXX,XX +XXX,XX @@
21
@@ -XXX,XX +XXX,XX @@ struct SMMUv3Class {
23
#ifndef HW_I386_MICROVM_H
22
/*< public >*/
24
#define HW_I386_MICROVM_H
23
25
24
DeviceRealize parent_realize;
26
-#include "qemu-common.h"
25
- DeviceReset parent_reset;
27
#include "exec/hwaddr.h"
26
+ ResettablePhases parent_phases;
28
#include "qemu/notify.h"
27
};
29
28
30
diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h
29
#define TYPE_ARM_SMMUV3 "arm-smmuv3"
30
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
31
index XXXXXXX..XXXXXXX 100644
31
index XXXXXXX..XXXXXXX 100644
32
--- a/include/hw/i386/x86.h
32
--- a/hw/arm/smmuv3.c
33
+++ b/include/hw/i386/x86.h
33
+++ b/hw/arm/smmuv3.c
34
@@ -XXX,XX +XXX,XX @@
34
@@ -XXX,XX +XXX,XX @@ static void smmu_init_irq(SMMUv3State *s, SysBusDevice *dev)
35
#ifndef HW_I386_X86_H
35
}
36
#define HW_I386_X86_H
36
}
37
37
38
-#include "qemu-common.h"
38
-static void smmu_reset(DeviceState *dev)
39
#include "exec/hwaddr.h"
39
+static void smmu_reset_hold(Object *obj)
40
#include "qemu/notify.h"
40
{
41
41
- SMMUv3State *s = ARM_SMMUV3(dev);
42
+ SMMUv3State *s = ARM_SMMUV3(obj);
43
SMMUv3Class *c = ARM_SMMUV3_GET_CLASS(s);
44
45
- c->parent_reset(dev);
46
+ if (c->parent_phases.hold) {
47
+ c->parent_phases.hold(obj);
48
+ }
49
50
smmuv3_init_regs(s);
51
}
52
@@ -XXX,XX +XXX,XX @@ static void smmuv3_instance_init(Object *obj)
53
static void smmuv3_class_init(ObjectClass *klass, void *data)
54
{
55
DeviceClass *dc = DEVICE_CLASS(klass);
56
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
57
SMMUv3Class *c = ARM_SMMUV3_CLASS(klass);
58
59
dc->vmsd = &vmstate_smmuv3;
60
- device_class_set_parent_reset(dc, smmu_reset, &c->parent_reset);
61
+ resettable_class_set_parent_phases(rc, NULL, smmu_reset_hold, NULL,
62
+ &c->parent_phases);
63
c->parent_realize = dc->realize;
64
dc->realize = smmu_realize;
65
}
42
--
66
--
43
2.25.1
67
2.25.1
44
68
45
69
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
Convert the TYPE_ARM_GIC_COMMON device to 3-phase reset. This is a
2
simple no-behaviour-change conversion.
2
3
3
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
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@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20221109161444.3397405-4-peter.maydell@linaro.org
6
---
8
---
7
target/arm/translate-a64.c | 7 ++++---
9
hw/intc/arm_gic_common.c | 7 ++++---
8
1 file changed, 4 insertions(+), 3 deletions(-)
10
1 file changed, 4 insertions(+), 3 deletions(-)
9
11
10
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
12
diff --git a/hw/intc/arm_gic_common.c b/hw/intc/arm_gic_common.c
11
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
12
--- a/target/arm/translate-a64.c
14
--- a/hw/intc/arm_gic_common.c
13
+++ b/target/arm/translate-a64.c
15
+++ b/hw/intc/arm_gic_common.c
14
@@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
16
@@ -XXX,XX +XXX,XX @@ static inline void arm_gic_common_reset_irq_state(GICState *s, int first_cpu,
17
}
18
}
19
20
-static void arm_gic_common_reset(DeviceState *dev)
21
+static void arm_gic_common_reset_hold(Object *obj)
15
{
22
{
16
DisasContext *s = container_of(dcbase, DisasContext, base);
23
- GICState *s = ARM_GIC_COMMON(dev);
17
CPUARMState *env = cpu->env_ptr;
24
+ GICState *s = ARM_GIC_COMMON(obj);
18
+ uint64_t pc = s->base.pc_next;
25
int i, j;
19
uint32_t insn;
26
int resetprio;
20
27
21
if (s->ss_active && !s->pstate_ss) {
28
@@ -XXX,XX +XXX,XX @@ static Property arm_gic_common_properties[] = {
22
@@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
29
static void arm_gic_common_class_init(ObjectClass *klass, void *data)
23
return;
30
{
24
}
31
DeviceClass *dc = DEVICE_CLASS(klass);
25
32
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
26
- s->pc_curr = s->base.pc_next;
33
ARMLinuxBootIfClass *albifc = ARM_LINUX_BOOT_IF_CLASS(klass);
27
- insn = arm_ldl_code(env, &s->base, s->base.pc_next, s->sctlr_b);
34
28
+ s->pc_curr = pc;
35
- dc->reset = arm_gic_common_reset;
29
+ insn = arm_ldl_code(env, &s->base, pc, s->sctlr_b);
36
+ rc->phases.hold = arm_gic_common_reset_hold;
30
s->insn = insn;
37
dc->realize = arm_gic_common_realize;
31
- s->base.pc_next += 4;
38
device_class_set_props(dc, arm_gic_common_properties);
32
+ s->base.pc_next = pc + 4;
39
dc->vmsd = &vmstate_gic;
33
34
s->fp_access_checked = false;
35
s->sve_access_checked = false;
36
--
40
--
37
2.25.1
41
2.25.1
38
42
39
43
diff view generated by jsdifflib
1
A lot of C files in hw/arm include qemu-common.h when they don't
1
Now we have converted TYPE_ARM_GIC_COMMON, we can convert the
2
need anything from it. Drop the include lines.
2
TYPE_ARM_GIC_KVM subclass to 3-phase reset.
3
4
omap1.c, pxa2xx.c and strongarm.c retain the include because they
5
use it for the prototype of qemu_get_timedate().
6
3
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
6
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
10
Reviewed-by: Taylor Simpson <tsimpson@quicinc.com>
7
Message-id: 20221109161444.3397405-5-peter.maydell@linaro.org
11
Reviewed-by: Yoshinori Sato <ysato@users.sourceforge.jp>
12
Message-id: 20211129200510.1233037-5-peter.maydell@linaro.org
13
---
8
---
14
hw/arm/boot.c | 1 -
9
hw/intc/arm_gic_kvm.c | 14 +++++++++-----
15
hw/arm/digic_boards.c | 1 -
10
1 file changed, 9 insertions(+), 5 deletions(-)
16
hw/arm/highbank.c | 1 -
17
hw/arm/npcm7xx_boards.c | 1 -
18
hw/arm/sbsa-ref.c | 1 -
19
hw/arm/stm32f405_soc.c | 1 -
20
hw/arm/vexpress.c | 1 -
21
hw/arm/virt.c | 1 -
22
8 files changed, 8 deletions(-)
23
11
24
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
12
diff --git a/hw/intc/arm_gic_kvm.c b/hw/intc/arm_gic_kvm.c
25
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
26
--- a/hw/arm/boot.c
14
--- a/hw/intc/arm_gic_kvm.c
27
+++ b/hw/arm/boot.c
15
+++ b/hw/intc/arm_gic_kvm.c
28
@@ -XXX,XX +XXX,XX @@
16
@@ -XXX,XX +XXX,XX @@ DECLARE_OBJ_CHECKERS(GICState, KVMARMGICClass,
29
*/
17
struct KVMARMGICClass {
30
18
ARMGICCommonClass parent_class;
31
#include "qemu/osdep.h"
19
DeviceRealize parent_realize;
32
-#include "qemu-common.h"
20
- void (*parent_reset)(DeviceState *dev);
33
#include "qemu/datadir.h"
21
+ ResettablePhases parent_phases;
34
#include "qemu/error-report.h"
22
};
35
#include "qapi/error.h"
23
36
diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c
24
void kvm_arm_gic_set_irq(uint32_t num_irq, int irq, int level)
37
index XXXXXXX..XXXXXXX 100644
25
@@ -XXX,XX +XXX,XX @@ static void kvm_arm_gic_get(GICState *s)
38
--- a/hw/arm/digic_boards.c
26
}
39
+++ b/hw/arm/digic_boards.c
27
}
40
@@ -XXX,XX +XXX,XX @@
28
41
29
-static void kvm_arm_gic_reset(DeviceState *dev)
42
#include "qemu/osdep.h"
30
+static void kvm_arm_gic_reset_hold(Object *obj)
43
#include "qapi/error.h"
31
{
44
-#include "qemu-common.h"
32
- GICState *s = ARM_GIC_COMMON(dev);
45
#include "qemu/datadir.h"
33
+ GICState *s = ARM_GIC_COMMON(obj);
46
#include "hw/boards.h"
34
KVMARMGICClass *kgc = KVM_ARM_GIC_GET_CLASS(s);
47
#include "qemu/error-report.h"
35
48
diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c
36
- kgc->parent_reset(dev);
49
index XXXXXXX..XXXXXXX 100644
37
+ if (kgc->parent_phases.hold) {
50
--- a/hw/arm/highbank.c
38
+ kgc->parent_phases.hold(obj);
51
+++ b/hw/arm/highbank.c
39
+ }
52
@@ -XXX,XX +XXX,XX @@
40
53
*/
41
if (kvm_arm_gic_can_save_restore(s)) {
54
42
kvm_arm_gic_put(s);
55
#include "qemu/osdep.h"
43
@@ -XXX,XX +XXX,XX @@ static void kvm_arm_gic_realize(DeviceState *dev, Error **errp)
56
-#include "qemu-common.h"
44
static void kvm_arm_gic_class_init(ObjectClass *klass, void *data)
57
#include "qemu/datadir.h"
45
{
58
#include "qapi/error.h"
46
DeviceClass *dc = DEVICE_CLASS(klass);
59
#include "hw/sysbus.h"
47
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
60
diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c
48
ARMGICCommonClass *agcc = ARM_GIC_COMMON_CLASS(klass);
61
index XXXXXXX..XXXXXXX 100644
49
KVMARMGICClass *kgc = KVM_ARM_GIC_CLASS(klass);
62
--- a/hw/arm/npcm7xx_boards.c
50
63
+++ b/hw/arm/npcm7xx_boards.c
51
@@ -XXX,XX +XXX,XX @@ static void kvm_arm_gic_class_init(ObjectClass *klass, void *data)
64
@@ -XXX,XX +XXX,XX @@
52
agcc->post_load = kvm_arm_gic_put;
65
#include "hw/qdev-core.h"
53
device_class_set_parent_realize(dc, kvm_arm_gic_realize,
66
#include "hw/qdev-properties.h"
54
&kgc->parent_realize);
67
#include "qapi/error.h"
55
- device_class_set_parent_reset(dc, kvm_arm_gic_reset, &kgc->parent_reset);
68
-#include "qemu-common.h"
56
+ resettable_class_set_parent_phases(rc, NULL, kvm_arm_gic_reset_hold, NULL,
69
#include "qemu/datadir.h"
57
+ &kgc->parent_phases);
70
#include "qemu/units.h"
58
}
71
#include "sysemu/blockdev.h"
59
72
diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
60
static const TypeInfo kvm_arm_gic_info = {
73
index XXXXXXX..XXXXXXX 100644
74
--- a/hw/arm/sbsa-ref.c
75
+++ b/hw/arm/sbsa-ref.c
76
@@ -XXX,XX +XXX,XX @@
77
*/
78
79
#include "qemu/osdep.h"
80
-#include "qemu-common.h"
81
#include "qemu/datadir.h"
82
#include "qapi/error.h"
83
#include "qemu/error-report.h"
84
diff --git a/hw/arm/stm32f405_soc.c b/hw/arm/stm32f405_soc.c
85
index XXXXXXX..XXXXXXX 100644
86
--- a/hw/arm/stm32f405_soc.c
87
+++ b/hw/arm/stm32f405_soc.c
88
@@ -XXX,XX +XXX,XX @@
89
90
#include "qemu/osdep.h"
91
#include "qapi/error.h"
92
-#include "qemu-common.h"
93
#include "exec/address-spaces.h"
94
#include "sysemu/sysemu.h"
95
#include "hw/arm/stm32f405_soc.h"
96
diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
97
index XXXXXXX..XXXXXXX 100644
98
--- a/hw/arm/vexpress.c
99
+++ b/hw/arm/vexpress.c
100
@@ -XXX,XX +XXX,XX @@
101
102
#include "qemu/osdep.h"
103
#include "qapi/error.h"
104
-#include "qemu-common.h"
105
#include "qemu/datadir.h"
106
#include "cpu.h"
107
#include "hw/sysbus.h"
108
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
109
index XXXXXXX..XXXXXXX 100644
110
--- a/hw/arm/virt.c
111
+++ b/hw/arm/virt.c
112
@@ -XXX,XX +XXX,XX @@
113
*/
114
115
#include "qemu/osdep.h"
116
-#include "qemu-common.h"
117
#include "qemu/datadir.h"
118
#include "qemu/units.h"
119
#include "qemu/option.h"
120
--
61
--
121
2.25.1
62
2.25.1
122
63
123
64
diff view generated by jsdifflib
1
The qemu-common.h header is not supposed to be included from any
1
Convert the TYPE_ARM_GICV3_COMMON parent class to 3-phase reset.
2
other header files, only from .c files (as documented in a comment at
3
the start of it).
4
5
Nothing actually relies on target/rx/cpu.h including it, so we can
6
just drop the include.
7
2
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
5
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
Reviewed-by: Taylor Simpson <tsimpson@quicinc.com>
6
Message-id: 20221109161444.3397405-6-peter.maydell@linaro.org
12
Reviewed-by: Yoshinori Sato <ysato@users.sourceforge.jp>
13
Message-id: 20211129200510.1233037-4-peter.maydell@linaro.org
14
---
7
---
15
target/rx/cpu.h | 1 -
8
hw/intc/arm_gicv3_common.c | 7 ++++---
16
1 file changed, 1 deletion(-)
9
1 file changed, 4 insertions(+), 3 deletions(-)
17
10
18
diff --git a/target/rx/cpu.h b/target/rx/cpu.h
11
diff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c
19
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
20
--- a/target/rx/cpu.h
13
--- a/hw/intc/arm_gicv3_common.c
21
+++ b/target/rx/cpu.h
14
+++ b/hw/intc/arm_gicv3_common.c
22
@@ -XXX,XX +XXX,XX @@
15
@@ -XXX,XX +XXX,XX @@ static void arm_gicv3_finalize(Object *obj)
23
#define RX_CPU_H
16
g_free(s->redist_region_count);
24
17
}
25
#include "qemu/bitops.h"
18
26
-#include "qemu-common.h"
19
-static void arm_gicv3_common_reset(DeviceState *dev)
27
#include "hw/registerfields.h"
20
+static void arm_gicv3_common_reset_hold(Object *obj)
28
#include "cpu-qom.h"
21
{
29
22
- GICv3State *s = ARM_GICV3_COMMON(dev);
23
+ GICv3State *s = ARM_GICV3_COMMON(obj);
24
int i;
25
26
for (i = 0; i < s->num_cpu; i++) {
27
@@ -XXX,XX +XXX,XX @@ static Property arm_gicv3_common_properties[] = {
28
static void arm_gicv3_common_class_init(ObjectClass *klass, void *data)
29
{
30
DeviceClass *dc = DEVICE_CLASS(klass);
31
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
32
ARMLinuxBootIfClass *albifc = ARM_LINUX_BOOT_IF_CLASS(klass);
33
34
- dc->reset = arm_gicv3_common_reset;
35
+ rc->phases.hold = arm_gicv3_common_reset_hold;
36
dc->realize = arm_gicv3_common_realize;
37
device_class_set_props(dc, arm_gicv3_common_properties);
38
dc->vmsd = &vmstate_gicv3;
30
--
39
--
31
2.25.1
40
2.25.1
32
41
33
42
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
Convert the TYPE_KVM_ARM_GICV3 device to 3-phase reset.
2
2
3
gicv3_set_gicv3state() is used by arm_gicv3_common.c in
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
arm_gicv3_common_realize(). Since we want to restrict
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
arm_gicv3_cpuif.c to TCG, extract gicv3_set_gicv3state()
5
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6
to a new file. Add this file to the meson 'specific'
6
Message-id: 20221109161444.3397405-7-peter.maydell@linaro.org
7
source set, since it needs access to "cpu.h".
7
---
8
hw/intc/arm_gicv3_kvm.c | 14 +++++++++-----
9
1 file changed, 9 insertions(+), 5 deletions(-)
8
10
9
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
11
diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
Message-id: 20211115223619.2599282-2-philmd@redhat.com
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
14
hw/intc/arm_gicv3_cpuif.c | 10 +---------
15
hw/intc/arm_gicv3_cpuif_common.c | 22 ++++++++++++++++++++++
16
hw/intc/meson.build | 1 +
17
3 files changed, 24 insertions(+), 9 deletions(-)
18
create mode 100644 hw/intc/arm_gicv3_cpuif_common.c
19
20
diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c
21
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
22
--- a/hw/intc/arm_gicv3_cpuif.c
13
--- a/hw/intc/arm_gicv3_kvm.c
23
+++ b/hw/intc/arm_gicv3_cpuif.c
14
+++ b/hw/intc/arm_gicv3_kvm.c
24
@@ -XXX,XX +XXX,XX @@
15
@@ -XXX,XX +XXX,XX @@ DECLARE_OBJ_CHECKERS(GICv3State, KVMARMGICv3Class,
25
/*
16
struct KVMARMGICv3Class {
26
- * ARM Generic Interrupt Controller v3
17
ARMGICv3CommonClass parent_class;
27
+ * ARM Generic Interrupt Controller v3 (emulation)
18
DeviceRealize parent_realize;
28
*
19
- void (*parent_reset)(DeviceState *dev);
29
* Copyright (c) 2016 Linaro Limited
20
+ ResettablePhases parent_phases;
30
* Written by Peter Maydell
21
};
31
@@ -XXX,XX +XXX,XX @@
22
32
#include "hw/irq.h"
23
static void kvm_arm_gicv3_set_irq(void *opaque, int irq, int level)
33
#include "cpu.h"
24
@@ -XXX,XX +XXX,XX @@ static void arm_gicv3_icc_reset(CPUARMState *env, const ARMCPRegInfo *ri)
34
25
c->icc_ctlr_el1[GICV3_S] = c->icc_ctlr_el1[GICV3_NS];
35
-void gicv3_set_gicv3state(CPUState *cpu, GICv3CPUState *s)
26
}
36
-{
27
37
- ARMCPU *arm_cpu = ARM_CPU(cpu);
28
-static void kvm_arm_gicv3_reset(DeviceState *dev)
38
- CPUARMState *env = &arm_cpu->env;
29
+static void kvm_arm_gicv3_reset_hold(Object *obj)
39
-
40
- env->gicv3state = (void *)s;
41
-};
42
-
43
static GICv3CPUState *icc_cs_from_env(CPUARMState *env)
44
{
30
{
45
return env->gicv3state;
31
- GICv3State *s = ARM_GICV3_COMMON(dev);
46
diff --git a/hw/intc/arm_gicv3_cpuif_common.c b/hw/intc/arm_gicv3_cpuif_common.c
32
+ GICv3State *s = ARM_GICV3_COMMON(obj);
47
new file mode 100644
33
KVMARMGICv3Class *kgc = KVM_ARM_GICV3_GET_CLASS(s);
48
index XXXXXXX..XXXXXXX
34
49
--- /dev/null
35
DPRINTF("Reset\n");
50
+++ b/hw/intc/arm_gicv3_cpuif_common.c
36
51
@@ -XXX,XX +XXX,XX @@
37
- kgc->parent_reset(dev);
52
+/* SPDX-License-Identifier: GPL-2.0-or-later */
38
+ if (kgc->parent_phases.hold) {
53
+/*
39
+ kgc->parent_phases.hold(obj);
54
+ * ARM Generic Interrupt Controller v3
40
+ }
55
+ *
41
56
+ * Copyright (c) 2016 Linaro Limited
42
if (s->migration_blocker) {
57
+ * Written by Peter Maydell
43
DPRINTF("Cannot put kernel gic state, no kernel interface\n");
58
+ *
44
@@ -XXX,XX +XXX,XX @@ static void kvm_arm_gicv3_realize(DeviceState *dev, Error **errp)
59
+ * This code is licensed under the GPL, version 2 or (at your option)
45
static void kvm_arm_gicv3_class_init(ObjectClass *klass, void *data)
60
+ * any later version.
46
{
61
+ */
47
DeviceClass *dc = DEVICE_CLASS(klass);
62
+
48
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
63
+#include "qemu/osdep.h"
49
ARMGICv3CommonClass *agcc = ARM_GICV3_COMMON_CLASS(klass);
64
+#include "gicv3_internal.h"
50
KVMARMGICv3Class *kgc = KVM_ARM_GICV3_CLASS(klass);
65
+#include "cpu.h"
51
66
+
52
@@ -XXX,XX +XXX,XX @@ static void kvm_arm_gicv3_class_init(ObjectClass *klass, void *data)
67
+void gicv3_set_gicv3state(CPUState *cpu, GICv3CPUState *s)
53
agcc->post_load = kvm_arm_gicv3_put;
68
+{
54
device_class_set_parent_realize(dc, kvm_arm_gicv3_realize,
69
+ ARMCPU *arm_cpu = ARM_CPU(cpu);
55
&kgc->parent_realize);
70
+ CPUARMState *env = &arm_cpu->env;
56
- device_class_set_parent_reset(dc, kvm_arm_gicv3_reset, &kgc->parent_reset);
71
+
57
+ resettable_class_set_parent_phases(rc, NULL, kvm_arm_gicv3_reset_hold, NULL,
72
+ env->gicv3state = (void *)s;
58
+ &kgc->parent_phases);
73
+};
59
}
74
diff --git a/hw/intc/meson.build b/hw/intc/meson.build
60
75
index XXXXXXX..XXXXXXX 100644
61
static const TypeInfo kvm_arm_gicv3_info = {
76
--- a/hw/intc/meson.build
77
+++ b/hw/intc/meson.build
78
@@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_XLNX_ZYNQMP_PMU', if_true: files('xlnx-pmu-iomod-in
79
80
specific_ss.add(when: 'CONFIG_ALLWINNER_A10_PIC', if_true: files('allwinner-a10-pic.c'))
81
specific_ss.add(when: 'CONFIG_APIC', if_true: files('apic.c', 'apic_common.c'))
82
+specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif_common.c'))
83
specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif.c'))
84
specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gic_kvm.c'))
85
specific_ss.add(when: ['CONFIG_ARM_GIC_KVM', 'TARGET_AARCH64'], if_true: files('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c'))
86
--
62
--
87
2.25.1
63
2.25.1
88
64
89
65
diff view generated by jsdifflib
1
From: Joel Stanley <joel@jms.id.au>
1
Convert the TYPE_ARM_GICV3_ITS_COMMON parent class to 3-phase reset.
2
2
3
This is the latest URL for the OpenBMC CI. The old URL still works, but
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
redirects.
4
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20221109161444.3397405-8-peter.maydell@linaro.org
7
---
8
hw/intc/arm_gicv3_its_common.c | 7 ++++---
9
1 file changed, 4 insertions(+), 3 deletions(-)
5
10
6
Reviewed-by: Cédric Le Goater <clg@kaod.org>
11
diff --git a/hw/intc/arm_gicv3_its_common.c b/hw/intc/arm_gicv3_its_common.c
7
Signed-off-by: Joel Stanley <joel@jms.id.au>
8
Message-id: 20211117065752.330632-3-joel@jms.id.au
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
docs/system/arm/aspeed.rst | 2 +-
12
1 file changed, 1 insertion(+), 1 deletion(-)
13
14
diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst
15
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
16
--- a/docs/system/arm/aspeed.rst
13
--- a/hw/intc/arm_gicv3_its_common.c
17
+++ b/docs/system/arm/aspeed.rst
14
+++ b/hw/intc/arm_gicv3_its_common.c
18
@@ -XXX,XX +XXX,XX @@ The Aspeed machines can be started using the ``-kernel`` option to
15
@@ -XXX,XX +XXX,XX @@ void gicv3_its_init_mmio(GICv3ITSState *s, const MemoryRegionOps *ops,
19
load a Linux kernel or from a firmware. Images can be downloaded from
16
msi_nonbroken = true;
20
the OpenBMC jenkins :
17
}
21
18
22
- https://jenkins.openbmc.org/job/ci-openbmc/lastSuccessfulBuild/distro=ubuntu,label=docker-builder
19
-static void gicv3_its_common_reset(DeviceState *dev)
23
+ https://jenkins.openbmc.org/job/ci-openbmc/lastSuccessfulBuild/
20
+static void gicv3_its_common_reset_hold(Object *obj)
24
21
{
25
or directly from the OpenBMC GitHub release repository :
22
- GICv3ITSState *s = ARM_GICV3_ITS_COMMON(dev);
23
+ GICv3ITSState *s = ARM_GICV3_ITS_COMMON(obj);
24
25
s->ctlr = 0;
26
s->cbaser = 0;
27
@@ -XXX,XX +XXX,XX @@ static void gicv3_its_common_reset(DeviceState *dev)
28
static void gicv3_its_common_class_init(ObjectClass *klass, void *data)
29
{
30
DeviceClass *dc = DEVICE_CLASS(klass);
31
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
32
33
- dc->reset = gicv3_its_common_reset;
34
+ rc->phases.hold = gicv3_its_common_reset_hold;
35
dc->vmsd = &vmstate_its;
36
}
26
37
27
--
38
--
28
2.25.1
39
2.25.1
29
40
30
41
diff view generated by jsdifflib
1
From: Alex Bennée <alex.bennee@linaro.org>
1
Convert the TYPE_ARM_GICV3_ITS device to 3-phase reset.
2
2
3
While trying to debug a GIC ITS failure I saw some guest errors that
4
had poor formatting as well as leaving me confused as to what failed.
5
As most of the checks aren't possible without a valid dte split that
6
check apart and then check the other conditions in steps. This avoids
7
us relying on undefined data.
8
9
I still get a failure with the current kvm-unit-tests but at least I
10
know (partially) why now:
11
12
Exception return from AArch64 EL1 to AArch64 EL1 PC 0x40080588
13
PASS: gicv3: its-trigger: inv/invall: dev2/eventid=20 now triggers an LPI
14
ITS: MAPD devid=2 size = 0x8 itt=0x40430000 valid=0
15
INT dev_id=2 event_id=20
16
process_its_cmd: invalid command attributes: invalid dte: 0 for 2 (MEM_TX: 0)
17
PASS: gicv3: its-trigger: mapd valid=false: no LPI after device unmap
18
SUMMARY: 6 tests, 1 unexpected failures
19
20
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
21
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
22
Message-id: 20211112170454.3158925-1-alex.bennee@linaro.org
23
Cc: Shashi Mallela <shashi.mallela@linaro.org>
24
Cc: Peter Maydell <peter.maydell@linaro.org>
25
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6
Message-id: 20221109161444.3397405-9-peter.maydell@linaro.org
26
---
7
---
27
hw/intc/arm_gicv3_its.c | 39 +++++++++++++++++++++++++++------------
8
hw/intc/arm_gicv3_its.c | 14 +++++++++-----
28
1 file changed, 27 insertions(+), 12 deletions(-)
9
1 file changed, 9 insertions(+), 5 deletions(-)
29
10
30
diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c
11
diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c
31
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
32
--- a/hw/intc/arm_gicv3_its.c
13
--- a/hw/intc/arm_gicv3_its.c
33
+++ b/hw/intc/arm_gicv3_its.c
14
+++ b/hw/intc/arm_gicv3_its.c
34
@@ -XXX,XX +XXX,XX @@ static bool process_its_cmd(GICv3ITSState *s, uint64_t value, uint32_t offset,
15
@@ -XXX,XX +XXX,XX @@ DECLARE_OBJ_CHECKERS(GICv3ITSState, GICv3ITSClass,
35
if (res != MEMTX_OK) {
16
36
return result;
17
struct GICv3ITSClass {
37
}
18
GICv3ITSCommonClass parent_class;
38
+ } else {
19
- void (*parent_reset)(DeviceState *dev);
39
+ qemu_log_mask(LOG_GUEST_ERROR,
20
+ ResettablePhases parent_phases;
40
+ "%s: invalid command attributes: "
21
};
41
+ "invalid dte: %"PRIx64" for %d (MEM_TX: %d)\n",
22
42
+ __func__, dte, devid, res);
23
/*
43
+ return result;
24
@@ -XXX,XX +XXX,XX @@ static void gicv3_arm_its_realize(DeviceState *dev, Error **errp)
44
}
25
}
45
26
}
46
- if ((devid > s->dt.maxids.max_devids) || !dte_valid || !ite_valid ||
27
47
- !cte_valid || (eventid > max_eventid)) {
28
-static void gicv3_its_reset(DeviceState *dev)
48
+
29
+static void gicv3_its_reset_hold(Object *obj)
49
+ /*
30
{
50
+ * In this implementation, in case of guest errors we ignore the
31
- GICv3ITSState *s = ARM_GICV3_ITS_COMMON(dev);
51
+ * command and move onto the next command in the queue.
32
+ GICv3ITSState *s = ARM_GICV3_ITS_COMMON(obj);
52
+ */
33
GICv3ITSClass *c = ARM_GICV3_ITS_GET_CLASS(s);
53
+ if (devid > s->dt.maxids.max_devids) {
34
54
qemu_log_mask(LOG_GUEST_ERROR,
35
- c->parent_reset(dev);
55
- "%s: invalid command attributes "
36
+ if (c->parent_phases.hold) {
56
- "devid %d or eventid %d or invalid dte %d or"
37
+ c->parent_phases.hold(obj);
57
- "invalid cte %d or invalid ite %d\n",
38
+ }
58
- __func__, devid, eventid, dte_valid, cte_valid,
39
59
- ite_valid);
40
/* Quiescent bit reset to 1 */
60
- /*
41
s->ctlr = FIELD_DP32(s->ctlr, GITS_CTLR, QUIESCENT, 1);
61
- * in this implementation, in case of error
42
@@ -XXX,XX +XXX,XX @@ static Property gicv3_its_props[] = {
62
- * we ignore this command and move onto the next
43
static void gicv3_its_class_init(ObjectClass *klass, void *data)
63
- * command in the queue
44
{
64
- */
45
DeviceClass *dc = DEVICE_CLASS(klass);
65
+ "%s: invalid command attributes: devid %d>%d",
46
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
66
+ __func__, devid, s->dt.maxids.max_devids);
47
GICv3ITSClass *ic = ARM_GICV3_ITS_CLASS(klass);
67
+
48
GICv3ITSCommonClass *icc = ARM_GICV3_ITS_COMMON_CLASS(klass);
68
+ } else if (!dte_valid || !ite_valid || !cte_valid) {
49
69
+ qemu_log_mask(LOG_GUEST_ERROR,
50
dc->realize = gicv3_arm_its_realize;
70
+ "%s: invalid command attributes: "
51
device_class_set_props(dc, gicv3_its_props);
71
+ "dte: %s, ite: %s, cte: %s\n",
52
- device_class_set_parent_reset(dc, gicv3_its_reset, &ic->parent_reset);
72
+ __func__,
53
+ resettable_class_set_parent_phases(rc, NULL, gicv3_its_reset_hold, NULL,
73
+ dte_valid ? "valid" : "invalid",
54
+ &ic->parent_phases);
74
+ ite_valid ? "valid" : "invalid",
55
icc->post_load = gicv3_its_post_load;
75
+ cte_valid ? "valid" : "invalid");
56
}
76
+ } else if (eventid > max_eventid) {
57
77
+ qemu_log_mask(LOG_GUEST_ERROR,
78
+ "%s: invalid command attributes: eventid %d > %d\n",
79
+ __func__, eventid, max_eventid);
80
} else {
81
/*
82
* Current implementation only supports rdbase == procnum
83
--
58
--
84
2.25.1
59
2.25.1
85
60
86
61
diff view generated by jsdifflib
Deleted patch
1
From: Joel Stanley <joel@jms.id.au>
2
1
3
Add X11, FP5280G2, G220A, Rainier and Fuji. Mention that Swift will be
4
removed in v7.0.
5
6
Signed-off-by: Joel Stanley <joel@jms.id.au>
7
Reviewed-by: Cédric Le Goater <clg@kaod.org>
8
Message-id: 20211117065752.330632-2-joel@jms.id.au
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
docs/system/arm/aspeed.rst | 7 ++++++-
12
1 file changed, 6 insertions(+), 1 deletion(-)
13
14
diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst
15
index XXXXXXX..XXXXXXX 100644
16
--- a/docs/system/arm/aspeed.rst
17
+++ b/docs/system/arm/aspeed.rst
18
@@ -XXX,XX +XXX,XX @@ AST2400 SoC based machines :
19
20
- ``palmetto-bmc`` OpenPOWER Palmetto POWER8 BMC
21
- ``quanta-q71l-bmc`` OpenBMC Quanta BMC
22
+- ``supermicrox11-bmc`` Supermicro X11 BMC
23
24
AST2500 SoC based machines :
25
26
@@ -XXX,XX +XXX,XX @@ AST2500 SoC based machines :
27
- ``romulus-bmc`` OpenPOWER Romulus POWER9 BMC
28
- ``witherspoon-bmc`` OpenPOWER Witherspoon POWER9 BMC
29
- ``sonorapass-bmc`` OCP SonoraPass BMC
30
-- ``swift-bmc`` OpenPOWER Swift BMC POWER9
31
+- ``swift-bmc`` OpenPOWER Swift BMC POWER9 (to be removed in v7.0)
32
+- ``fp5280g2-bmc`` Inspur FP5280G2 BMC
33
+- ``g220a-bmc`` Bytedance G220A BMC
34
35
AST2600 SoC based machines :
36
37
- ``ast2600-evb`` Aspeed AST2600 Evaluation board (Cortex-A7)
38
- ``tacoma-bmc`` OpenPOWER Witherspoon POWER9 AST2600 BMC
39
+- ``rainier-bmc`` IBM Rainier POWER10 BMC
40
+- ``fuji-bmc`` Facebook Fuji BMC
41
42
Supported devices
43
-----------------
44
--
45
2.25.1
46
47
diff view generated by jsdifflib
Deleted patch
1
From: Joel Stanley <joel@jms.id.au>
2
1
3
A common use case for the ASPEED machine is to boot a Linux kernel.
4
Provide a full example command line.
5
6
Reviewed-by: Cédric Le Goater <clg@kaod.org>
7
Signed-off-by: Joel Stanley <joel@jms.id.au>
8
Message-id: 20211117065752.330632-4-joel@jms.id.au
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
docs/system/arm/aspeed.rst | 15 ++++++++++++---
12
1 file changed, 12 insertions(+), 3 deletions(-)
13
14
diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst
15
index XXXXXXX..XXXXXXX 100644
16
--- a/docs/system/arm/aspeed.rst
17
+++ b/docs/system/arm/aspeed.rst
18
@@ -XXX,XX +XXX,XX @@ Missing devices
19
Boot options
20
------------
21
22
-The Aspeed machines can be started using the ``-kernel`` option to
23
-load a Linux kernel or from a firmware. Images can be downloaded from
24
-the OpenBMC jenkins :
25
+The Aspeed machines can be started using the ``-kernel`` and ``-dtb`` options
26
+to load a Linux kernel or from a firmware. Images can be downloaded from the
27
+OpenBMC jenkins :
28
29
https://jenkins.openbmc.org/job/ci-openbmc/lastSuccessfulBuild/
30
31
@@ -XXX,XX +XXX,XX @@ or directly from the OpenBMC GitHub release repository :
32
33
https://github.com/openbmc/openbmc/releases
34
35
+To boot a kernel directly from a Linux build tree:
36
+
37
+.. code-block:: bash
38
+
39
+ $ qemu-system-arm -M ast2600-evb -nographic \
40
+ -kernel arch/arm/boot/zImage \
41
+ -dtb arch/arm/boot/dts/aspeed-ast2600-evb.dtb \
42
+ -initrd rootfs.cpio
43
+
44
The image should be attached as an MTD drive. Run :
45
46
.. code-block:: bash
47
--
48
2.25.1
49
50
diff view generated by jsdifflib
Deleted patch
1
From: Joel Stanley <joel@jms.id.au>
2
1
3
Move it to the supported list.
4
5
Signed-off-by: Joel Stanley <joel@jms.id.au>
6
Message-id: 20211117065752.330632-5-joel@jms.id.au
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
---
9
docs/system/arm/aspeed.rst | 2 +-
10
1 file changed, 1 insertion(+), 1 deletion(-)
11
12
diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst
13
index XXXXXXX..XXXXXXX 100644
14
--- a/docs/system/arm/aspeed.rst
15
+++ b/docs/system/arm/aspeed.rst
16
@@ -XXX,XX +XXX,XX @@ Supported devices
17
* Front LEDs (PCA9552 on I2C bus)
18
* LPC Peripheral Controller (a subset of subdevices are supported)
19
* Hash/Crypto Engine (HACE) - Hash support only. TODO: HMAC and RSA
20
+ * ADC
21
22
23
Missing devices
24
---------------
25
26
* Coprocessor support
27
- * ADC (out of tree implementation)
28
* PWM and Fan Controller
29
* Slave GPIO Controller
30
* Super I/O Controller
31
--
32
2.25.1
33
34
diff view generated by jsdifflib
Deleted patch
1
From: Olivier Hériveaux <olivier.heriveaux@ledger.fr>
2
1
3
Fix issue where the data register may be overwritten by next character
4
reception before being read and returned.
5
6
Signed-off-by: Olivier Hériveaux <olivier.heriveaux@ledger.fr>
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
9
Message-id: 20211128120723.4053-1-olivier.heriveaux@ledger.fr
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
12
hw/char/stm32f2xx_usart.c | 3 ++-
13
1 file changed, 2 insertions(+), 1 deletion(-)
14
15
diff --git a/hw/char/stm32f2xx_usart.c b/hw/char/stm32f2xx_usart.c
16
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/char/stm32f2xx_usart.c
18
+++ b/hw/char/stm32f2xx_usart.c
19
@@ -XXX,XX +XXX,XX @@ static uint64_t stm32f2xx_usart_read(void *opaque, hwaddr addr,
20
return retvalue;
21
case USART_DR:
22
DB_PRINT("Value: 0x%" PRIx32 ", %c\n", s->usart_dr, (char) s->usart_dr);
23
+ retvalue = s->usart_dr & 0x3FF;
24
s->usart_sr &= ~USART_SR_RXNE;
25
qemu_chr_fe_accept_input(&s->chr);
26
qemu_set_irq(s->irq, 0);
27
- return s->usart_dr & 0x3FF;
28
+ return retvalue;
29
case USART_BRR:
30
return s->usart_brr;
31
case USART_CR1:
32
--
33
2.25.1
34
35
diff view generated by jsdifflib
1
The qemu-common.h header is not supposed to be included from any
1
Convert the TYPE_KVM_ARM_ITS device to 3-phase reset.
2
other header files, only from .c files (as documented in a comment at
3
the start of it).
4
5
Move the include to linux-user/hexagon/cpu_loop.c, which needs it for
6
the declaration of cpu_exec_step_atomic().
7
2
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
5
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
Reviewed-by: Taylor Simpson <tsimpson@quicinc.com>
6
Message-id: 20221109161444.3397405-10-peter.maydell@linaro.org
12
Message-id: 20211129200510.1233037-3-peter.maydell@linaro.org
13
---
7
---
14
target/hexagon/cpu.h | 1 -
8
hw/intc/arm_gicv3_its_kvm.c | 14 +++++++++-----
15
linux-user/hexagon/cpu_loop.c | 1 +
9
1 file changed, 9 insertions(+), 5 deletions(-)
16
2 files changed, 1 insertion(+), 1 deletion(-)
17
10
18
diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h
11
diff --git a/hw/intc/arm_gicv3_its_kvm.c b/hw/intc/arm_gicv3_its_kvm.c
19
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
20
--- a/target/hexagon/cpu.h
13
--- a/hw/intc/arm_gicv3_its_kvm.c
21
+++ b/target/hexagon/cpu.h
14
+++ b/hw/intc/arm_gicv3_its_kvm.c
22
@@ -XXX,XX +XXX,XX @@ typedef struct CPUHexagonState CPUHexagonState;
15
@@ -XXX,XX +XXX,XX @@ DECLARE_OBJ_CHECKERS(GICv3ITSState, KVMARMITSClass,
23
16
24
#include "fpu/softfloat-types.h"
17
struct KVMARMITSClass {
25
18
GICv3ITSCommonClass parent_class;
26
-#include "qemu-common.h"
19
- void (*parent_reset)(DeviceState *dev);
27
#include "exec/cpu-defs.h"
20
+ ResettablePhases parent_phases;
28
#include "hex_regs.h"
21
};
29
#include "mmvec/mmvec.h"
22
30
diff --git a/linux-user/hexagon/cpu_loop.c b/linux-user/hexagon/cpu_loop.c
23
31
index XXXXXXX..XXXXXXX 100644
24
@@ -XXX,XX +XXX,XX @@ static void kvm_arm_its_post_load(GICv3ITSState *s)
32
--- a/linux-user/hexagon/cpu_loop.c
25
GITS_CTLR, &s->ctlr, true, &error_abort);
33
+++ b/linux-user/hexagon/cpu_loop.c
26
}
34
@@ -XXX,XX +XXX,XX @@
27
35
*/
28
-static void kvm_arm_its_reset(DeviceState *dev)
36
29
+static void kvm_arm_its_reset_hold(Object *obj)
37
#include "qemu/osdep.h"
30
{
38
+#include "qemu-common.h"
31
- GICv3ITSState *s = ARM_GICV3_ITS_COMMON(dev);
39
#include "qemu.h"
32
+ GICv3ITSState *s = ARM_GICV3_ITS_COMMON(obj);
40
#include "user-internals.h"
33
KVMARMITSClass *c = KVM_ARM_ITS_GET_CLASS(s);
41
#include "cpu_loop-common.h"
34
int i;
35
36
- c->parent_reset(dev);
37
+ if (c->parent_phases.hold) {
38
+ c->parent_phases.hold(obj);
39
+ }
40
41
if (kvm_device_check_attr(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CTRL,
42
KVM_DEV_ARM_ITS_CTRL_RESET)) {
43
@@ -XXX,XX +XXX,XX @@ static Property kvm_arm_its_props[] = {
44
static void kvm_arm_its_class_init(ObjectClass *klass, void *data)
45
{
46
DeviceClass *dc = DEVICE_CLASS(klass);
47
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
48
GICv3ITSCommonClass *icc = ARM_GICV3_ITS_COMMON_CLASS(klass);
49
KVMARMITSClass *ic = KVM_ARM_ITS_CLASS(klass);
50
51
dc->realize = kvm_arm_its_realize;
52
device_class_set_props(dc, kvm_arm_its_props);
53
- device_class_set_parent_reset(dc, kvm_arm_its_reset, &ic->parent_reset);
54
+ resettable_class_set_parent_phases(rc, NULL, kvm_arm_its_reset_hold, NULL,
55
+ &ic->parent_phases);
56
icc->send_msi = kvm_its_send_msi;
57
icc->pre_save = kvm_arm_its_pre_save;
58
icc->post_load = kvm_arm_its_post_load;
42
--
59
--
43
2.25.1
60
2.25.1
44
61
45
62
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Schspa Shi <schspa@gmail.com>
2
2
3
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3
We use 32bit value for linux,initrd-[start/end], when we have
4
loader_start > 4GB, there will be a wrong initrd_start passed
5
to the kernel, and the kernel will report the following warning.
6
7
[ 0.000000] ------------[ cut here ]------------
8
[ 0.000000] initrd not fully accessible via the linear mapping -- please check your bootloader ...
9
[ 0.000000] WARNING: CPU: 0 PID: 0 at arch/arm64/mm/init.c:355 arm64_memblock_init+0x158/0x244
10
[ 0.000000] Modules linked in:
11
[ 0.000000] CPU: 0 PID: 0 Comm: swapper Tainted: G W 6.1.0-rc3-13250-g30a0b95b1335-dirty #28
12
[ 0.000000] Hardware name: Horizon Sigi Virtual development board (DT)
13
[ 0.000000] pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
14
[ 0.000000] pc : arm64_memblock_init+0x158/0x244
15
[ 0.000000] lr : arm64_memblock_init+0x158/0x244
16
[ 0.000000] sp : ffff800009273df0
17
[ 0.000000] x29: ffff800009273df0 x28: 0000001000cc0010 x27: 0000800000000000
18
[ 0.000000] x26: 000000000050a3e2 x25: ffff800008b46000 x24: ffff800008b46000
19
[ 0.000000] x23: ffff800008a53000 x22: ffff800009420000 x21: ffff800008a53000
20
[ 0.000000] x20: 0000000004000000 x19: 0000000004000000 x18: 00000000ffff1020
21
[ 0.000000] x17: 6568632065736165 x16: 6c70202d2d20676e x15: 697070616d207261
22
[ 0.000000] x14: 656e696c20656874 x13: 0a2e2e2e20726564 x12: 0000000000000000
23
[ 0.000000] x11: 0000000000000000 x10: 00000000ffffffff x9 : 0000000000000000
24
[ 0.000000] x8 : 0000000000000000 x7 : 796c6c756620746f x6 : 6e20647274696e69
25
[ 0.000000] x5 : ffff8000093c7c47 x4 : ffff800008a2102f x3 : ffff800009273a88
26
[ 0.000000] x2 : 80000000fffff038 x1 : 00000000000000c0 x0 : 0000000000000056
27
[ 0.000000] Call trace:
28
[ 0.000000] arm64_memblock_init+0x158/0x244
29
[ 0.000000] setup_arch+0x164/0x1cc
30
[ 0.000000] start_kernel+0x94/0x4ac
31
[ 0.000000] __primary_switched+0xb4/0xbc
32
[ 0.000000] ---[ end trace 0000000000000000 ]---
33
[ 0.000000] Zone ranges:
34
[ 0.000000] DMA [mem 0x0000001000000000-0x0000001007ffffff]
35
36
This doesn't affect any machine types we currently support, because
37
for all of our machine types the RAM starts well below the 4GB
38
mark, but it does demonstrate that we're not currently writing
39
the device-tree properties quite as intended.
40
41
To fix it, we can change it to write these values to the dtb using a
42
type width matching #address-cells. This is the intended size for
43
these dtb properties, and is how u-boot, for instance, writes them,
44
although in practice the Linux kernel will cope with them being any
45
width as long as they're big enough to fit the value.
46
47
Signed-off-by: Schspa Shi <schspa@gmail.com>
48
Message-id: 20221129160724.75667-1-schspa@gmail.com
49
[PMM: tweaked commit message]
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
50
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
51
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
---
52
---
7
target/arm/translate.c | 16 ++++++++--------
53
hw/arm/boot.c | 10 ++++++----
8
1 file changed, 8 insertions(+), 8 deletions(-)
54
1 file changed, 6 insertions(+), 4 deletions(-)
9
55
10
diff --git a/target/arm/translate.c b/target/arm/translate.c
56
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
11
index XXXXXXX..XXXXXXX 100644
57
index XXXXXXX..XXXXXXX 100644
12
--- a/target/arm/translate.c
58
--- a/hw/arm/boot.c
13
+++ b/target/arm/translate.c
59
+++ b/hw/arm/boot.c
14
@@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
60
@@ -XXX,XX +XXX,XX @@ int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
15
{
16
DisasContext *dc = container_of(dcbase, DisasContext, base);
17
CPUARMState *env = cpu->env_ptr;
18
+ uint32_t pc = dc->base.pc_next;
19
uint32_t insn;
20
bool is_16bit;
21
22
if (arm_pre_translate_insn(dc)) {
23
- dc->base.pc_next += 2;
24
+ dc->base.pc_next = pc + 2;
25
return;
26
}
61
}
27
62
28
- dc->pc_curr = dc->base.pc_next;
63
if (binfo->initrd_size) {
29
- insn = arm_lduw_code(env, &dc->base, dc->base.pc_next, dc->sctlr_b);
64
- rc = qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-start",
30
+ dc->pc_curr = pc;
65
- binfo->initrd_start);
31
+ insn = arm_lduw_code(env, &dc->base, pc, dc->sctlr_b);
66
+ rc = qemu_fdt_setprop_sized_cells(fdt, "/chosen", "linux,initrd-start",
32
is_16bit = thumb_insn_is_16bit(dc, dc->base.pc_next, insn);
67
+ acells, binfo->initrd_start);
33
- dc->base.pc_next += 2;
68
if (rc < 0) {
34
+ pc += 2;
69
fprintf(stderr, "couldn't set /chosen/linux,initrd-start\n");
35
if (!is_16bit) {
70
goto fail;
36
- uint32_t insn2 = arm_lduw_code(env, &dc->base, dc->base.pc_next,
71
}
37
- dc->sctlr_b);
72
38
-
73
- rc = qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-end",
39
+ uint32_t insn2 = arm_lduw_code(env, &dc->base, pc, dc->sctlr_b);
74
- binfo->initrd_start + binfo->initrd_size);
40
insn = insn << 16 | insn2;
75
+ rc = qemu_fdt_setprop_sized_cells(fdt, "/chosen", "linux,initrd-end",
41
- dc->base.pc_next += 2;
76
+ acells,
42
+ pc += 2;
77
+ binfo->initrd_start +
43
}
78
+ binfo->initrd_size);
44
+ dc->base.pc_next = pc;
79
if (rc < 0) {
45
dc->insn = insn;
80
fprintf(stderr, "couldn't set /chosen/linux,initrd-end\n");
46
81
goto fail;
47
if (dc->pstate_il) {
48
--
82
--
49
2.25.1
83
2.25.1
50
51
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Zhuojia Shen <chaosdefinition@hotmail.com>
2
2
3
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3
In CPUID registers exposed to userspace, some registers were missing
4
and some fields were not exposed. This patch aligns exposed ID
5
registers and their fields with what the upstream kernel currently
6
exposes.
7
8
Specifically, the following new ID registers/fields are exposed to
9
userspace:
10
11
ID_AA64PFR1_EL1.BT: bits 3-0
12
ID_AA64PFR1_EL1.MTE: bits 11-8
13
ID_AA64PFR1_EL1.SME: bits 27-24
14
15
ID_AA64ZFR0_EL1.SVEver: bits 3-0
16
ID_AA64ZFR0_EL1.AES: bits 7-4
17
ID_AA64ZFR0_EL1.BitPerm: bits 19-16
18
ID_AA64ZFR0_EL1.BF16: bits 23-20
19
ID_AA64ZFR0_EL1.SHA3: bits 35-32
20
ID_AA64ZFR0_EL1.SM4: bits 43-40
21
ID_AA64ZFR0_EL1.I8MM: bits 47-44
22
ID_AA64ZFR0_EL1.F32MM: bits 55-52
23
ID_AA64ZFR0_EL1.F64MM: bits 59-56
24
25
ID_AA64SMFR0_EL1.F32F32: bit 32
26
ID_AA64SMFR0_EL1.B16F32: bit 34
27
ID_AA64SMFR0_EL1.F16F32: bit 35
28
ID_AA64SMFR0_EL1.I8I32: bits 39-36
29
ID_AA64SMFR0_EL1.F64F64: bit 48
30
ID_AA64SMFR0_EL1.I16I64: bits 55-52
31
ID_AA64SMFR0_EL1.FA64: bit 63
32
33
ID_AA64MMFR0_EL1.ECV: bits 63-60
34
35
ID_AA64MMFR1_EL1.AFP: bits 47-44
36
37
ID_AA64MMFR2_EL1.AT: bits 35-32
38
39
ID_AA64ISAR0_EL1.RNDR: bits 63-60
40
41
ID_AA64ISAR1_EL1.FRINTTS: bits 35-32
42
ID_AA64ISAR1_EL1.BF16: bits 47-44
43
ID_AA64ISAR1_EL1.DGH: bits 51-48
44
ID_AA64ISAR1_EL1.I8MM: bits 55-52
45
46
ID_AA64ISAR2_EL1.WFxT: bits 3-0
47
ID_AA64ISAR2_EL1.RPRES: bits 7-4
48
ID_AA64ISAR2_EL1.GPA3: bits 11-8
49
ID_AA64ISAR2_EL1.APA3: bits 15-12
50
51
The code is also refactored to use symbolic names for ID register fields
52
for better readability and maintainability.
53
54
Signed-off-by: Zhuojia Shen <chaosdefinition@hotmail.com>
55
Message-id: DS7PR12MB6309BC9133877BCC6FC419FEAC0D9@DS7PR12MB6309.namprd12.prod.outlook.com
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
56
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
57
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
---
58
---
7
target/arm/translate.c | 9 +++++----
59
target/arm/helper.c | 96 +++++++++++++++++++++++++++++++++++++--------
8
1 file changed, 5 insertions(+), 4 deletions(-)
60
1 file changed, 79 insertions(+), 17 deletions(-)
9
61
10
diff --git a/target/arm/translate.c b/target/arm/translate.c
62
diff --git a/target/arm/helper.c b/target/arm/helper.c
11
index XXXXXXX..XXXXXXX 100644
63
index XXXXXXX..XXXXXXX 100644
12
--- a/target/arm/translate.c
64
--- a/target/arm/helper.c
13
+++ b/target/arm/translate.c
65
+++ b/target/arm/helper.c
14
@@ -XXX,XX +XXX,XX @@ static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
66
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
15
{
67
#ifdef CONFIG_USER_ONLY
16
DisasContext *dc = container_of(dcbase, DisasContext, base);
68
static const ARMCPRegUserSpaceInfo v8_user_idregs[] = {
17
CPUARMState *env = cpu->env_ptr;
69
{ .name = "ID_AA64PFR0_EL1",
18
+ uint32_t pc = dc->base.pc_next;
70
- .exported_bits = 0x000f000f00ff0000,
19
unsigned int insn;
71
- .fixed_bits = 0x0000000000000011 },
20
72
+ .exported_bits = R_ID_AA64PFR0_FP_MASK |
21
if (arm_pre_translate_insn(dc)) {
73
+ R_ID_AA64PFR0_ADVSIMD_MASK |
22
- dc->base.pc_next += 4;
74
+ R_ID_AA64PFR0_SVE_MASK |
23
+ dc->base.pc_next = pc + 4;
75
+ R_ID_AA64PFR0_DIT_MASK,
24
return;
76
+ .fixed_bits = (0x1 << R_ID_AA64PFR0_EL0_SHIFT) |
25
}
77
+ (0x1 << R_ID_AA64PFR0_EL1_SHIFT) },
26
78
{ .name = "ID_AA64PFR1_EL1",
27
- dc->pc_curr = dc->base.pc_next;
79
- .exported_bits = 0x00000000000000f0 },
28
- insn = arm_ldl_code(env, &dc->base, dc->base.pc_next, dc->sctlr_b);
80
+ .exported_bits = R_ID_AA64PFR1_BT_MASK |
29
+ dc->pc_curr = pc;
81
+ R_ID_AA64PFR1_SSBS_MASK |
30
+ insn = arm_ldl_code(env, &dc->base, pc, dc->sctlr_b);
82
+ R_ID_AA64PFR1_MTE_MASK |
31
dc->insn = insn;
83
+ R_ID_AA64PFR1_SME_MASK },
32
- dc->base.pc_next += 4;
84
{ .name = "ID_AA64PFR*_EL1_RESERVED",
33
+ dc->base.pc_next = pc + 4;
85
- .is_glob = true },
34
disas_arm_insn(dc, insn);
86
- { .name = "ID_AA64ZFR0_EL1" },
35
87
+ .is_glob = true },
36
arm_post_translate_insn(dc);
88
+ { .name = "ID_AA64ZFR0_EL1",
89
+ .exported_bits = R_ID_AA64ZFR0_SVEVER_MASK |
90
+ R_ID_AA64ZFR0_AES_MASK |
91
+ R_ID_AA64ZFR0_BITPERM_MASK |
92
+ R_ID_AA64ZFR0_BFLOAT16_MASK |
93
+ R_ID_AA64ZFR0_SHA3_MASK |
94
+ R_ID_AA64ZFR0_SM4_MASK |
95
+ R_ID_AA64ZFR0_I8MM_MASK |
96
+ R_ID_AA64ZFR0_F32MM_MASK |
97
+ R_ID_AA64ZFR0_F64MM_MASK },
98
+ { .name = "ID_AA64SMFR0_EL1",
99
+ .exported_bits = R_ID_AA64SMFR0_F32F32_MASK |
100
+ R_ID_AA64SMFR0_B16F32_MASK |
101
+ R_ID_AA64SMFR0_F16F32_MASK |
102
+ R_ID_AA64SMFR0_I8I32_MASK |
103
+ R_ID_AA64SMFR0_F64F64_MASK |
104
+ R_ID_AA64SMFR0_I16I64_MASK |
105
+ R_ID_AA64SMFR0_FA64_MASK },
106
{ .name = "ID_AA64MMFR0_EL1",
107
- .fixed_bits = 0x00000000ff000000 },
108
- { .name = "ID_AA64MMFR1_EL1" },
109
+ .exported_bits = R_ID_AA64MMFR0_ECV_MASK,
110
+ .fixed_bits = (0xf << R_ID_AA64MMFR0_TGRAN64_SHIFT) |
111
+ (0xf << R_ID_AA64MMFR0_TGRAN4_SHIFT) },
112
+ { .name = "ID_AA64MMFR1_EL1",
113
+ .exported_bits = R_ID_AA64MMFR1_AFP_MASK },
114
+ { .name = "ID_AA64MMFR2_EL1",
115
+ .exported_bits = R_ID_AA64MMFR2_AT_MASK },
116
{ .name = "ID_AA64MMFR*_EL1_RESERVED",
117
- .is_glob = true },
118
+ .is_glob = true },
119
{ .name = "ID_AA64DFR0_EL1",
120
- .fixed_bits = 0x0000000000000006 },
121
- { .name = "ID_AA64DFR1_EL1" },
122
+ .fixed_bits = (0x6 << R_ID_AA64DFR0_DEBUGVER_SHIFT) },
123
+ { .name = "ID_AA64DFR1_EL1" },
124
{ .name = "ID_AA64DFR*_EL1_RESERVED",
125
- .is_glob = true },
126
+ .is_glob = true },
127
{ .name = "ID_AA64AFR*",
128
- .is_glob = true },
129
+ .is_glob = true },
130
{ .name = "ID_AA64ISAR0_EL1",
131
- .exported_bits = 0x00fffffff0fffff0 },
132
+ .exported_bits = R_ID_AA64ISAR0_AES_MASK |
133
+ R_ID_AA64ISAR0_SHA1_MASK |
134
+ R_ID_AA64ISAR0_SHA2_MASK |
135
+ R_ID_AA64ISAR0_CRC32_MASK |
136
+ R_ID_AA64ISAR0_ATOMIC_MASK |
137
+ R_ID_AA64ISAR0_RDM_MASK |
138
+ R_ID_AA64ISAR0_SHA3_MASK |
139
+ R_ID_AA64ISAR0_SM3_MASK |
140
+ R_ID_AA64ISAR0_SM4_MASK |
141
+ R_ID_AA64ISAR0_DP_MASK |
142
+ R_ID_AA64ISAR0_FHM_MASK |
143
+ R_ID_AA64ISAR0_TS_MASK |
144
+ R_ID_AA64ISAR0_RNDR_MASK },
145
{ .name = "ID_AA64ISAR1_EL1",
146
- .exported_bits = 0x000000f0ffffffff },
147
+ .exported_bits = R_ID_AA64ISAR1_DPB_MASK |
148
+ R_ID_AA64ISAR1_APA_MASK |
149
+ R_ID_AA64ISAR1_API_MASK |
150
+ R_ID_AA64ISAR1_JSCVT_MASK |
151
+ R_ID_AA64ISAR1_FCMA_MASK |
152
+ R_ID_AA64ISAR1_LRCPC_MASK |
153
+ R_ID_AA64ISAR1_GPA_MASK |
154
+ R_ID_AA64ISAR1_GPI_MASK |
155
+ R_ID_AA64ISAR1_FRINTTS_MASK |
156
+ R_ID_AA64ISAR1_SB_MASK |
157
+ R_ID_AA64ISAR1_BF16_MASK |
158
+ R_ID_AA64ISAR1_DGH_MASK |
159
+ R_ID_AA64ISAR1_I8MM_MASK },
160
+ { .name = "ID_AA64ISAR2_EL1",
161
+ .exported_bits = R_ID_AA64ISAR2_WFXT_MASK |
162
+ R_ID_AA64ISAR2_RPRES_MASK |
163
+ R_ID_AA64ISAR2_GPA3_MASK |
164
+ R_ID_AA64ISAR2_APA3_MASK },
165
{ .name = "ID_AA64ISAR*_EL1_RESERVED",
166
- .is_glob = true },
167
+ .is_glob = true },
168
};
169
modify_arm_cp_regs(v8_idregs, v8_user_idregs);
170
#endif
171
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
172
#ifdef CONFIG_USER_ONLY
173
static const ARMCPRegUserSpaceInfo id_v8_user_midr_cp_reginfo[] = {
174
{ .name = "MIDR_EL1",
175
- .exported_bits = 0x00000000ffffffff },
176
- { .name = "REVIDR_EL1" },
177
+ .exported_bits = R_MIDR_EL1_REVISION_MASK |
178
+ R_MIDR_EL1_PARTNUM_MASK |
179
+ R_MIDR_EL1_ARCHITECTURE_MASK |
180
+ R_MIDR_EL1_VARIANT_MASK |
181
+ R_MIDR_EL1_IMPLEMENTER_MASK },
182
+ { .name = "REVIDR_EL1" },
183
};
184
modify_arm_cp_regs(id_v8_midr_cp_reginfo, id_v8_user_midr_cp_reginfo);
185
#endif
37
--
186
--
38
2.25.1
187
2.25.1
39
40
diff view generated by jsdifflib
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
1
From: Thomas Huth <thuth@redhat.com>
2
2
3
When a virtio-iommu is instantiated, describe it using the ACPI VIOT
3
The header target/arm/kvm-consts.h checks CONFIG_KVM which is marked as
4
table.
4
poisoned in common code, so the files that include this header have to
5
be added to specific_ss and recompiled for each, qemu-system-arm and
6
qemu-system-aarch64. However, since the kvm headers are only optionally
7
used in kvm-constants.h for some sanity checks, we can additionally
8
check the NEED_CPU_H macro first to avoid the poisoned CONFIG_KVM macro,
9
so kvm-constants.h can also be used from "common" files (without the
10
sanity checks - which should be OK since they are still done from other
11
target-specific files instead). This way, and by adjusting some other
12
include statements in the related files here and there, we can move some
13
files from specific_ss into softmmu_ss, so that they only need to be
14
compiled once during the build process.
5
15
6
Acked-by: Igor Mammedov <imammedo@redhat.com>
16
Signed-off-by: Thomas Huth <thuth@redhat.com>
7
Reviewed-by: Eric Auger <eric.auger@redhat.com>
17
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
18
Message-id: 20221202154023.293614-1-thuth@redhat.com
9
Message-id: 20211210170415.583179-2-jean-philippe@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
20
---
12
hw/arm/virt-acpi-build.c | 7 +++++++
21
include/hw/misc/xlnx-zynqmp-apu-ctrl.h | 2 +-
13
hw/arm/Kconfig | 1 +
22
target/arm/kvm-consts.h | 8 ++++----
14
2 files changed, 8 insertions(+)
23
hw/misc/imx6_src.c | 2 +-
24
hw/misc/iotkit-sysctl.c | 1 -
25
hw/misc/meson.build | 11 +++++------
26
5 files changed, 11 insertions(+), 13 deletions(-)
15
27
16
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
28
diff --git a/include/hw/misc/xlnx-zynqmp-apu-ctrl.h b/include/hw/misc/xlnx-zynqmp-apu-ctrl.h
17
index XXXXXXX..XXXXXXX 100644
29
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/arm/virt-acpi-build.c
30
--- a/include/hw/misc/xlnx-zynqmp-apu-ctrl.h
19
+++ b/hw/arm/virt-acpi-build.c
31
+++ b/include/hw/misc/xlnx-zynqmp-apu-ctrl.h
20
@@ -XXX,XX +XXX,XX @@
32
@@ -XXX,XX +XXX,XX @@
21
#include "kvm_arm.h"
33
22
#include "migration/vmstate.h"
34
#include "hw/sysbus.h"
23
#include "hw/acpi/ghes.h"
35
#include "hw/register.h"
24
+#include "hw/acpi/viot.h"
36
-#include "target/arm/cpu.h"
25
37
+#include "target/arm/cpu-qom.h"
26
#define ARM_SPI_BASE 32
38
27
39
#define TYPE_XLNX_ZYNQMP_APU_CTRL "xlnx.apu-ctrl"
28
@@ -XXX,XX +XXX,XX @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables)
40
OBJECT_DECLARE_SIMPLE_TYPE(XlnxZynqMPAPUCtrl, XLNX_ZYNQMP_APU_CTRL)
29
}
41
diff --git a/target/arm/kvm-consts.h b/target/arm/kvm-consts.h
42
index XXXXXXX..XXXXXXX 100644
43
--- a/target/arm/kvm-consts.h
44
+++ b/target/arm/kvm-consts.h
45
@@ -XXX,XX +XXX,XX @@
46
#ifndef ARM_KVM_CONSTS_H
47
#define ARM_KVM_CONSTS_H
48
49
+#ifdef NEED_CPU_H
50
#ifdef CONFIG_KVM
51
#include <linux/kvm.h>
52
#include <linux/psci.h>
53
-
54
#define MISMATCH_CHECK(X, Y) QEMU_BUILD_BUG_ON(X != Y)
55
+#endif
56
+#endif
57
58
-#else
59
-
60
+#ifndef MISMATCH_CHECK
61
#define MISMATCH_CHECK(X, Y) QEMU_BUILD_BUG_ON(0)
62
-
30
#endif
63
#endif
31
64
32
+ if (vms->iommu == VIRT_IOMMU_VIRTIO) {
65
#define CP_REG_SIZE_SHIFT 52
33
+ acpi_add_table(table_offsets, tables_blob);
66
diff --git a/hw/misc/imx6_src.c b/hw/misc/imx6_src.c
34
+ build_viot(ms, tables_blob, tables->linker, vms->virtio_iommu_bdf,
35
+ vms->oem_id, vms->oem_table_id);
36
+ }
37
+
38
/* XSDT is pointed to by RSDP */
39
xsdt = tables_blob->len;
40
build_xsdt(tables_blob, tables->linker, table_offsets, vms->oem_id,
41
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
42
index XXXXXXX..XXXXXXX 100644
67
index XXXXXXX..XXXXXXX 100644
43
--- a/hw/arm/Kconfig
68
--- a/hw/misc/imx6_src.c
44
+++ b/hw/arm/Kconfig
69
+++ b/hw/misc/imx6_src.c
45
@@ -XXX,XX +XXX,XX @@ config ARM_VIRT
70
@@ -XXX,XX +XXX,XX @@
46
select DIMM
71
#include "qemu/log.h"
47
select ACPI_HW_REDUCED
72
#include "qemu/main-loop.h"
48
select ACPI_APEI
73
#include "qemu/module.h"
49
+ select ACPI_VIOT
74
-#include "arm-powerctl.h"
50
75
+#include "target/arm/arm-powerctl.h"
51
config CHEETAH
76
#include "hw/core/cpu.h"
52
bool
77
78
#ifndef DEBUG_IMX6_SRC
79
diff --git a/hw/misc/iotkit-sysctl.c b/hw/misc/iotkit-sysctl.c
80
index XXXXXXX..XXXXXXX 100644
81
--- a/hw/misc/iotkit-sysctl.c
82
+++ b/hw/misc/iotkit-sysctl.c
83
@@ -XXX,XX +XXX,XX @@
84
#include "hw/qdev-properties.h"
85
#include "hw/arm/armsse-version.h"
86
#include "target/arm/arm-powerctl.h"
87
-#include "target/arm/cpu.h"
88
89
REG32(SECDBGSTAT, 0x0)
90
REG32(SECDBGSET, 0x4)
91
diff --git a/hw/misc/meson.build b/hw/misc/meson.build
92
index XXXXXXX..XXXXXXX 100644
93
--- a/hw/misc/meson.build
94
+++ b/hw/misc/meson.build
95
@@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_IMX', if_true: files(
96
'imx25_ccm.c',
97
'imx31_ccm.c',
98
'imx6_ccm.c',
99
+ 'imx6_src.c',
100
'imx6ul_ccm.c',
101
'imx7_ccm.c',
102
'imx7_gpr.c',
103
@@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_RASPI', if_true: files(
104
))
105
softmmu_ss.add(when: 'CONFIG_SLAVIO', if_true: files('slavio_misc.c'))
106
softmmu_ss.add(when: 'CONFIG_ZYNQ', if_true: files('zynq_slcr.c'))
107
-specific_ss.add(when: 'CONFIG_XLNX_ZYNQMP_ARM', if_true: files('xlnx-zynqmp-crf.c'))
108
-specific_ss.add(when: 'CONFIG_XLNX_ZYNQMP_ARM', if_true: files('xlnx-zynqmp-apu-ctrl.c'))
109
+softmmu_ss.add(when: 'CONFIG_XLNX_ZYNQMP_ARM', if_true: files('xlnx-zynqmp-crf.c'))
110
+softmmu_ss.add(when: 'CONFIG_XLNX_ZYNQMP_ARM', if_true: files('xlnx-zynqmp-apu-ctrl.c'))
111
specific_ss.add(when: 'CONFIG_XLNX_VERSAL', if_true: files('xlnx-versal-crl.c'))
112
softmmu_ss.add(when: 'CONFIG_XLNX_VERSAL', if_true: files(
113
'xlnx-versal-xramc.c',
114
@@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_TZ_MPC', if_true: files('tz-mpc.c'))
115
softmmu_ss.add(when: 'CONFIG_TZ_MSC', if_true: files('tz-msc.c'))
116
softmmu_ss.add(when: 'CONFIG_TZ_PPC', if_true: files('tz-ppc.c'))
117
softmmu_ss.add(when: 'CONFIG_IOTKIT_SECCTL', if_true: files('iotkit-secctl.c'))
118
+softmmu_ss.add(when: 'CONFIG_IOTKIT_SYSCTL', if_true: files('iotkit-sysctl.c'))
119
softmmu_ss.add(when: 'CONFIG_IOTKIT_SYSINFO', if_true: files('iotkit-sysinfo.c'))
120
softmmu_ss.add(when: 'CONFIG_ARMSSE_CPU_PWRCTRL', if_true: files('armsse-cpu-pwrctrl.c'))
121
softmmu_ss.add(when: 'CONFIG_ARMSSE_CPUID', if_true: files('armsse-cpuid.c'))
122
@@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_GRLIB', if_true: files('grlib_ahb_apb_pnp.c'))
123
124
specific_ss.add(when: 'CONFIG_AVR_POWER', if_true: files('avr_power.c'))
125
126
-specific_ss.add(when: 'CONFIG_IMX', if_true: files('imx6_src.c'))
127
-specific_ss.add(when: 'CONFIG_IOTKIT_SYSCTL', if_true: files('iotkit-sysctl.c'))
128
-
129
specific_ss.add(when: 'CONFIG_MAC_VIA', if_true: files('mac_via.c'))
130
131
specific_ss.add(when: 'CONFIG_MIPS_CPS', if_true: files('mips_cmgcr.c', 'mips_cpc.c'))
132
specific_ss.add(when: 'CONFIG_MIPS_ITU', if_true: files('mips_itu.c'))
133
134
-specific_ss.add(when: 'CONFIG_SBSA_REF', if_true: files('sbsa_ec.c'))
135
+softmmu_ss.add(when: 'CONFIG_SBSA_REF', if_true: files('sbsa_ec.c'))
136
137
# HPPA devices
138
softmmu_ss.add(when: 'CONFIG_LASI', if_true: files('lasi.c'))
53
--
139
--
54
2.25.1
140
2.25.1
55
141
56
142
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Create arm_check_ss_active and arm_check_kernelpage.
3
When building with --disable-tcg on Darwin we get:
4
4
5
Reverse the order of the tests. While it doesn't matter in practice,
5
target/arm/cpu.c:725:16: error: incomplete definition of type 'struct TCGCPUOps'
6
because only user-only has a kernel page and user-only never sets
6
cc->tcg_ops->do_interrupt(cs);
7
ss_active, ss_active has priority over execution exceptions and it
7
~~~~~~~~~~~^
8
is best to keep them in the proper order.
9
8
10
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Commit 083afd18a9 ("target/arm: Restrict cpu_exec_interrupt()
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
handler to sysemu") limited this block to system emulation,
11
but neglected to also limit it to TCG.
12
13
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
14
Reviewed-by: Fabiano Rosas <farosas@suse.de>
15
Message-id: 20221209110823.59495-1-philmd@linaro.org
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
17
---
14
target/arm/translate.c | 10 +++++++---
18
target/arm/cpu.c | 5 +++--
15
1 file changed, 7 insertions(+), 3 deletions(-)
19
1 file changed, 3 insertions(+), 2 deletions(-)
16
20
17
diff --git a/target/arm/translate.c b/target/arm/translate.c
21
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
18
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
19
--- a/target/arm/translate.c
23
--- a/target/arm/cpu.c
20
+++ b/target/arm/translate.c
24
+++ b/target/arm/cpu.c
21
@@ -XXX,XX +XXX,XX @@ static void arm_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu)
25
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset(DeviceState *dev)
22
dc->insn_start = tcg_last_op();
26
arm_rebuild_hflags(env);
23
}
27
}
24
28
25
-static bool arm_pre_translate_insn(DisasContext *dc)
29
-#ifndef CONFIG_USER_ONLY
26
+static bool arm_check_kernelpage(DisasContext *dc)
30
+#if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY)
31
32
static inline bool arm_excp_unmasked(CPUState *cs, unsigned int excp_idx,
33
unsigned int target_el,
34
@@ -XXX,XX +XXX,XX @@ static bool arm_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
35
cc->tcg_ops->do_interrupt(cs);
36
return true;
37
}
38
-#endif /* !CONFIG_USER_ONLY */
39
+
40
+#endif /* CONFIG_TCG && !CONFIG_USER_ONLY */
41
42
void arm_cpu_update_virq(ARMCPU *cpu)
27
{
43
{
28
#ifdef CONFIG_USER_ONLY
29
/* Intercept jump to the magic kernel page. */
30
@@ -XXX,XX +XXX,XX @@ static bool arm_pre_translate_insn(DisasContext *dc)
31
return true;
32
}
33
#endif
34
+ return false;
35
+}
36
37
+static bool arm_check_ss_active(DisasContext *dc)
38
+{
39
if (dc->ss_active && !dc->pstate_ss) {
40
/* Singlestep state is Active-pending.
41
* If we're in this state at the start of a TB then either
42
@@ -XXX,XX +XXX,XX @@ static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
43
uint32_t pc = dc->base.pc_next;
44
unsigned int insn;
45
46
- if (arm_pre_translate_insn(dc)) {
47
+ if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) {
48
dc->base.pc_next = pc + 4;
49
return;
50
}
51
@@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
52
uint32_t insn;
53
bool is_16bit;
54
55
- if (arm_pre_translate_insn(dc)) {
56
+ if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) {
57
dc->base.pc_next = pc + 2;
58
return;
59
}
60
--
44
--
61
2.25.1
45
2.25.1
62
46
63
47
diff view generated by jsdifflib