1 | Big pullreq this week, since it's got RTH's PAN/UAO/ATS1E1 | 1 | The following changes since commit bf4460a8d9a86f6cfe05d7a7f470c48e3a93d8b2: |
---|---|---|---|
2 | implementation in it, and also Philippe's raspi board model | ||
3 | cleanup patchset, as well as a scattering of smaller stuff. | ||
4 | 2 | ||
5 | -- PMM | 3 | Merge tag 'pull-tcg-20230123' of https://gitlab.com/rth7680/qemu into staging (2023-02-03 09:30:45 +0000) |
6 | |||
7 | |||
8 | The following changes since commit 7ce9ce89930ce260af839fb3e3e5f9101f5c69a0: | ||
9 | |||
10 | Merge remote-tracking branch 'remotes/kraxel/tags/ui-20200212-pull-request' into staging (2020-02-13 11:06:32 +0000) | ||
11 | 4 | ||
12 | are available in the Git repository at: | 5 | are available in the Git repository at: |
13 | 6 | ||
14 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200213 | 7 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20230203 |
15 | 8 | ||
16 | for you to fetch changes up to dc7a88d0810ad272bdcd2e0869359af78fdd9114: | 9 | for you to fetch changes up to bb18151d8bd9bedc497ee9d4e8d81b39a4e5bbf6: |
17 | 10 | ||
18 | target/arm: Implement ARMv8.1-VMID16 extension (2020-02-13 14:30:51 +0000) | 11 | target/arm: Enable FEAT_FGT on '-cpu max' (2023-02-03 12:59:24 +0000) |
19 | 12 | ||
20 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
21 | target-arm queue: | 14 | target-arm queue: |
22 | * i.MX: Fix inverted sense of register bits in watchdog timer | 15 | * Fix physical address resolution for Stage2 |
23 | * i.MX: Add support for WDT on i.MX6 | 16 | * pl011: refactoring, implement reset method |
24 | * arm/virt: cleanups to ACPI tables | 17 | * Support GICv3 with hvf acceleration |
25 | * Implement ARMv8.1-VMID16 extension | 18 | * sbsa-ref: remove cortex-a76 from list of supported cpus |
26 | * Implement ARMv8.1-PAN | 19 | * Correct syndrome for ATS12NSO* traps at Secure EL1 |
27 | * Implement ARMv8.2-UAO | 20 | * Fix priority of HSTR_EL2 traps vs UNDEFs |
28 | * Implement ARMv8.2-ATS1E1 | 21 | * Implement FEAT_FGT for '-cpu max' |
29 | * ast2400/2500/2600: Wire up EHCI controllers | ||
30 | * hw/char/exynos4210_uart: Fix memleaks in exynos4210_uart_init | ||
31 | * hw/arm/raspi: Clean up the board code | ||
32 | 22 | ||
33 | ---------------------------------------------------------------- | 23 | ---------------------------------------------------------------- |
34 | Chen Qun (1): | 24 | Alexander Graf (3): |
35 | hw/char/exynos4210_uart: Fix memleaks in exynos4210_uart_init | 25 | hvf: arm: Add support for GICv3 |
26 | hw/arm/virt: Consolidate GIC finalize logic | ||
27 | hw/arm/virt: Make accels in GIC finalize logic explicit | ||
36 | 28 | ||
37 | Guenter Roeck (2): | 29 | Evgeny Iakovlev (4): |
38 | hw/arm: ast2400/ast2500: Wire up EHCI controllers | 30 | hw/char/pl011: refactor FIFO depth handling code |
39 | hw/arm: ast2600: Wire up EHCI controllers | 31 | hw/char/pl011: add post_load hook for backwards-compatibility |
32 | hw/char/pl011: implement a reset method | ||
33 | hw/char/pl011: better handling of FIFO flags on LCR reset | ||
40 | 34 | ||
41 | Heyi Guo (7): | 35 | Marcin Juszkiewicz (1): |
42 | bios-tables-test: prepare to change ARM virt ACPI DSDT | 36 | sbsa-ref: remove cortex-a76 from list of supported cpus |
43 | arm/virt/acpi: remove meaningless sub device "RP0" from PCI0 | ||
44 | arm/virt/acpi: remove _ADR from devices identified by _HID | ||
45 | arm/acpi: fix PCI _PRT definition | ||
46 | arm/acpi: fix duplicated _UID of PCI interrupt link devices | ||
47 | arm/acpi: simplify the description of PCI _CRS | ||
48 | virt/acpi: update golden masters for DSDT update | ||
49 | 37 | ||
50 | Peter Maydell (1): | 38 | Peter Maydell (23): |
51 | target/arm: Implement ARMv8.1-VMID16 extension | 39 | target/arm: Name AT_S1E1RP and AT_S1E1WP cpregs correctly |
40 | target/arm: Correct syndrome for ATS12NSO* at Secure EL1 | ||
41 | target/arm: Remove CP_ACCESS_TRAP_UNCATEGORIZED_{EL2, EL3} | ||
42 | target/arm: Move do_coproc_insn() syndrome calculation earlier | ||
43 | target/arm: All UNDEF-at-EL0 traps take priority over HSTR_EL2 traps | ||
44 | target/arm: Make HSTR_EL2 traps take priority over UNDEF-at-EL1 | ||
45 | target/arm: Disable HSTR_EL2 traps if EL2 is not enabled | ||
46 | target/arm: Define the FEAT_FGT registers | ||
47 | target/arm: Implement FGT trapping infrastructure | ||
48 | target/arm: Mark up sysregs for HFGRTR bits 0..11 | ||
49 | target/arm: Mark up sysregs for HFGRTR bits 12..23 | ||
50 | target/arm: Mark up sysregs for HFGRTR bits 24..35 | ||
51 | target/arm: Mark up sysregs for HFGRTR bits 36..63 | ||
52 | target/arm: Mark up sysregs for HDFGRTR bits 0..11 | ||
53 | target/arm: Mark up sysregs for HDFGRTR bits 12..63 | ||
54 | target/arm: Mark up sysregs for HFGITR bits 0..11 | ||
55 | target/arm: Mark up sysregs for HFGITR bits 12..17 | ||
56 | target/arm: Mark up sysregs for HFGITR bits 18..47 | ||
57 | target/arm: Mark up sysregs for HFGITR bits 48..63 | ||
58 | target/arm: Implement the HFGITR_EL2.ERET trap | ||
59 | target/arm: Implement the HFGITR_EL2.SVC_EL0 and SVC_EL1 traps | ||
60 | target/arm: Implement MDCR_EL2.TDCC and MDCR_EL3.TDCC traps | ||
61 | target/arm: Enable FEAT_FGT on '-cpu max' | ||
52 | 62 | ||
53 | Philippe Mathieu-Daudé (13): | 63 | Richard Henderson (2): |
54 | hw/arm/raspi: Use BCM2708 machine type with pre Device Tree kernels | 64 | hw/arm: Use TYPE_ARM_SMMUV3 |
55 | hw/arm/raspi: Correct the board descriptions | 65 | target/arm: Fix physical address resolution for Stage2 |
56 | hw/arm/raspi: Extract the version from the board revision | ||
57 | hw/arm/raspi: Extract the RAM size from the board revision | ||
58 | hw/arm/raspi: Extract the processor type from the board revision | ||
59 | hw/arm/raspi: Trivial code movement | ||
60 | hw/arm/raspi: Make machines children of abstract RaspiMachineClass | ||
61 | hw/arm/raspi: Make board_rev a field of RaspiMachineClass | ||
62 | hw/arm/raspi: Let class_init() directly call raspi_machine_init() | ||
63 | hw/arm/raspi: Set default RAM size to size encoded in board revision | ||
64 | hw/arm/raspi: Extract the board model from the board revision | ||
65 | hw/arm/raspi: Use a unique raspi_machine_class_init() method | ||
66 | hw/arm/raspi: Extract the cores count from the board revision | ||
67 | 66 | ||
68 | Richard Henderson (20): | 67 | docs/system/arm/emulation.rst | 1 + |
69 | target/arm: Add arm_mmu_idx_is_stage1_of_2 | 68 | include/hw/arm/virt.h | 15 +- |
70 | target/arm: Add mmu_idx for EL1 and EL2 w/ PAN enabled | 69 | include/hw/char/pl011.h | 5 +- |
71 | target/arm: Add isar_feature tests for PAN + ATS1E1 | 70 | target/arm/cpregs.h | 484 +++++++++++++++++++++++++++++++++++++++++- |
72 | target/arm: Move LOR regdefs to file scope | 71 | target/arm/cpu.h | 18 ++ |
73 | target/arm: Split out aarch32_cpsr_valid_mask | 72 | target/arm/internals.h | 20 ++ |
74 | target/arm: Mask CPSR_J when Jazelle is not enabled | 73 | target/arm/syndrome.h | 10 + |
75 | target/arm: Replace CPSR_ERET_MASK with aarch32_cpsr_valid_mask | 74 | target/arm/translate.h | 6 + |
76 | target/arm: Use aarch32_cpsr_valid_mask in helper_exception_return | 75 | hw/arm/sbsa-ref.c | 4 +- |
77 | target/arm: Remove CPSR_RESERVED | 76 | hw/arm/virt.c | 203 +++++++++--------- |
78 | target/arm: Introduce aarch64_pstate_valid_mask | 77 | hw/char/pl011.c | 93 ++++++-- |
79 | target/arm: Update MSR access for PAN | 78 | hw/intc/arm_gicv3_cpuif.c | 18 +- |
80 | target/arm: Update arm_mmu_idx_el for PAN | 79 | target/arm/cpu64.c | 1 + |
81 | target/arm: Enforce PAN semantics in get_S1prot | 80 | target/arm/debug_helper.c | 46 +++- |
82 | target/arm: Set PAN bit as required on exception entry | 81 | target/arm/helper.c | 245 ++++++++++++++++++++- |
83 | target/arm: Implement ATS1E1 system registers | 82 | target/arm/hvf/hvf.c | 151 +++++++++++++ |
84 | target/arm: Enable ARMv8.2-ATS1E1 in -cpu max | 83 | target/arm/op_helper.c | 58 ++++- |
85 | target/arm: Add ID_AA64MMFR2_EL1 | 84 | target/arm/ptw.c | 2 +- |
86 | target/arm: Update MSR access to UAO | 85 | target/arm/translate-a64.c | 22 +- |
87 | target/arm: Implement UAO semantics | 86 | target/arm/translate.c | 125 +++++++---- |
88 | target/arm: Enable ARMv8.2-UAO in -cpu max | 87 | target/arm/hvf/trace-events | 2 + |
89 | 88 | 21 files changed, 1340 insertions(+), 189 deletions(-) | |
90 | Roman Kapl (2): | ||
91 | i.MX: Fix inverted register bits in wdt code. | ||
92 | i.MX: Add support for WDT on i.MX6 | ||
93 | |||
94 | include/hw/arm/aspeed_soc.h | 6 + | ||
95 | include/hw/arm/fsl-imx6.h | 3 + | ||
96 | target/arm/cpu-param.h | 2 +- | ||
97 | target/arm/cpu.h | 95 ++++++++--- | ||
98 | target/arm/internals.h | 85 ++++++++++ | ||
99 | hw/arm/aspeed_ast2600.c | 23 +++ | ||
100 | hw/arm/aspeed_soc.c | 25 +++ | ||
101 | hw/arm/fsl-imx6.c | 21 +++ | ||
102 | hw/arm/raspi.c | 190 ++++++++++++++++------ | ||
103 | hw/arm/virt-acpi-build.c | 25 +-- | ||
104 | hw/char/exynos4210_uart.c | 5 +- | ||
105 | hw/misc/imx2_wdt.c | 2 +- | ||
106 | target/arm/cpu.c | 4 + | ||
107 | target/arm/cpu64.c | 10 ++ | ||
108 | target/arm/helper-a64.c | 6 +- | ||
109 | target/arm/helper.c | 327 +++++++++++++++++++++++++++++--------- | ||
110 | target/arm/kvm64.c | 2 + | ||
111 | target/arm/op_helper.c | 14 +- | ||
112 | target/arm/translate-a64.c | 31 ++++ | ||
113 | target/arm/translate.c | 42 +++-- | ||
114 | tests/data/acpi/virt/DSDT | Bin 18462 -> 5307 bytes | ||
115 | tests/data/acpi/virt/DSDT.memhp | Bin 19799 -> 6644 bytes | ||
116 | tests/data/acpi/virt/DSDT.numamem | Bin 18462 -> 5307 bytes | ||
117 | 23 files changed, 731 insertions(+), 187 deletions(-) | ||
118 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Roman Kapl <rka@sysgo.com> | ||
2 | 1 | ||
3 | Documentation says for WDA '0: Assert WDOG output.' and for SRS | ||
4 | '0: Assert system reset signal.'. | ||
5 | |||
6 | Signed-off-by: Roman Kapl <rka@sysgo.com> | ||
7 | Message-id: 20200207095409.11227-1-rka@sysgo.com | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | hw/misc/imx2_wdt.c | 2 +- | ||
12 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
13 | |||
14 | diff --git a/hw/misc/imx2_wdt.c b/hw/misc/imx2_wdt.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/hw/misc/imx2_wdt.c | ||
17 | +++ b/hw/misc/imx2_wdt.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static void imx2_wdt_write(void *opaque, hwaddr addr, | ||
19 | uint64_t value, unsigned int size) | ||
20 | { | ||
21 | if (addr == IMX2_WDT_WCR && | ||
22 | - (value & (IMX2_WDT_WCR_WDA | IMX2_WDT_WCR_SRS))) { | ||
23 | + (~value & (IMX2_WDT_WCR_WDA | IMX2_WDT_WCR_SRS))) { | ||
24 | watchdog_perform_action(); | ||
25 | } | ||
26 | } | ||
27 | -- | ||
28 | 2.20.1 | ||
29 | |||
30 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | The J bit signals Jazelle mode, and so of course is RES0 | 3 | Use the macro instead of two explicit string literals. |
4 | when the feature is not enabled. | ||
5 | 4 | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
8 | Message-id: 20200208125816.14954-7-richard.henderson@linaro.org | 7 | Reviewed-by: Eric Auger <eric.auger@redhat.com> |
8 | Message-id: 20230124232059.4017615-1-richard.henderson@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 10 | --- |
11 | target/arm/internals.h | 5 ++++- | 11 | hw/arm/sbsa-ref.c | 3 ++- |
12 | 1 file changed, 4 insertions(+), 1 deletion(-) | 12 | hw/arm/virt.c | 2 +- |
13 | 2 files changed, 3 insertions(+), 2 deletions(-) | ||
13 | 14 | ||
14 | diff --git a/target/arm/internals.h b/target/arm/internals.h | 15 | diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c |
15 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/internals.h | 17 | --- a/hw/arm/sbsa-ref.c |
17 | +++ b/target/arm/internals.h | 18 | +++ b/hw/arm/sbsa-ref.c |
18 | @@ -XXX,XX +XXX,XX @@ static inline bool arm_mmu_idx_is_stage1_of_2(ARMMMUIdx mmu_idx) | 19 | @@ -XXX,XX +XXX,XX @@ |
19 | static inline uint32_t aarch32_cpsr_valid_mask(uint64_t features, | 20 | #include "exec/hwaddr.h" |
20 | const ARMISARegisters *id) | 21 | #include "kvm_arm.h" |
21 | { | 22 | #include "hw/arm/boot.h" |
22 | - uint32_t valid = CPSR_M | CPSR_AIF | CPSR_IL | CPSR_NZCV | CPSR_J; | 23 | +#include "hw/arm/smmuv3.h" |
23 | + uint32_t valid = CPSR_M | CPSR_AIF | CPSR_IL | CPSR_NZCV; | 24 | #include "hw/block/flash.h" |
24 | 25 | #include "hw/boards.h" | |
25 | if ((features >> ARM_FEATURE_V4T) & 1) { | 26 | #include "hw/ide/internal.h" |
26 | valid |= CPSR_T; | 27 | @@ -XXX,XX +XXX,XX @@ static void create_smmu(const SBSAMachineState *sms, PCIBus *bus) |
27 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t aarch32_cpsr_valid_mask(uint64_t features, | 28 | DeviceState *dev; |
28 | if ((features >> ARM_FEATURE_THUMB2) & 1) { | 29 | int i; |
29 | valid |= CPSR_IT; | 30 | |
31 | - dev = qdev_new("arm-smmuv3"); | ||
32 | + dev = qdev_new(TYPE_ARM_SMMUV3); | ||
33 | |||
34 | object_property_set_link(OBJECT(dev), "primary-bus", OBJECT(bus), | ||
35 | &error_abort); | ||
36 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
37 | index XXXXXXX..XXXXXXX 100644 | ||
38 | --- a/hw/arm/virt.c | ||
39 | +++ b/hw/arm/virt.c | ||
40 | @@ -XXX,XX +XXX,XX @@ static void create_smmu(const VirtMachineState *vms, | ||
41 | return; | ||
30 | } | 42 | } |
31 | + if (isar_feature_jazelle(id)) { | 43 | |
32 | + valid |= CPSR_J; | 44 | - dev = qdev_new("arm-smmuv3"); |
33 | + } | 45 | + dev = qdev_new(TYPE_ARM_SMMUV3); |
34 | 46 | ||
35 | return valid; | 47 | object_property_set_link(OBJECT(dev), "primary-bus", OBJECT(bus), |
36 | } | 48 | &error_abort); |
37 | -- | 49 | -- |
38 | 2.20.1 | 50 | 2.34.1 |
39 | 51 | ||
40 | 52 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 3 | Conversion to probe_access_full missed applying the page offset. |
4 | |||
5 | Cc: qemu-stable@nongnu.org | ||
6 | Reported-by: Sid Manning <sidneym@quicinc.com> | ||
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
5 | Message-id: 20200208125816.14954-21-richard.henderson@linaro.org | 8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
9 | Message-id: 20230126233134.103193-1-richard.henderson@linaro.org | ||
10 | Fixes: f3639a64f602 ("target/arm: Use softmmu tlbs for page table walking") | ||
11 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 13 | --- |
8 | target/arm/cpu64.c | 4 ++++ | 14 | target/arm/ptw.c | 2 +- |
9 | 1 file changed, 4 insertions(+) | 15 | 1 file changed, 1 insertion(+), 1 deletion(-) |
10 | 16 | ||
11 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | 17 | diff --git a/target/arm/ptw.c b/target/arm/ptw.c |
12 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/target/arm/cpu64.c | 19 | --- a/target/arm/ptw.c |
14 | +++ b/target/arm/cpu64.c | 20 | +++ b/target/arm/ptw.c |
15 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | 21 | @@ -XXX,XX +XXX,XX @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw, |
16 | t = FIELD_DP64(t, ID_AA64MMFR1, PAN, 2); /* ATS1E1 */ | 22 | if (unlikely(flags & TLB_INVALID_MASK)) { |
17 | cpu->isar.id_aa64mmfr1 = t; | 23 | goto fail; |
18 | 24 | } | |
19 | + t = cpu->isar.id_aa64mmfr2; | 25 | - ptw->out_phys = full->phys_addr; |
20 | + t = FIELD_DP64(t, ID_AA64MMFR2, UAO, 1); | 26 | + ptw->out_phys = full->phys_addr | (addr & ~TARGET_PAGE_MASK); |
21 | + cpu->isar.id_aa64mmfr2 = t; | 27 | ptw->out_rw = full->prot & PAGE_WRITE; |
22 | + | 28 | pte_attrs = full->pte_attrs; |
23 | /* Replicate the same data to the 32-bit id registers. */ | 29 | pte_secure = full->attrs.secure; |
24 | u = cpu->isar.id_isar5; | ||
25 | u = FIELD_DP32(u, ID_ISAR5, AES, 2); /* AES + PMULL */ | ||
26 | -- | 30 | -- |
27 | 2.20.1 | 31 | 2.34.1 |
28 | 32 | ||
29 | 33 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Evgeny Iakovlev <eiakovlev@linux.microsoft.com> |
---|---|---|---|
2 | 2 | ||
3 | The count of ARM cores is encoded in the board revision. Add a | 3 | PL011 can be in either of 2 modes depending guest config: FIFO and |
4 | helper to extract the number of cores, and use it. This will be | 4 | single register. The last mode could be viewed as a 1-element-deep FIFO. |
5 | helpful when we add the Raspi0/1 that have a single core. | ||
6 | 5 | ||
7 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 6 | Current code open-codes a bunch of depth-dependent logic. Refactor FIFO |
8 | Message-id: 20200208165645.15657-14-f4bug@amsat.org | 7 | depth handling code to isolate calculating current FIFO depth. |
8 | |||
9 | One functional (albeit guest-invisible) side-effect of this change is | ||
10 | that previously we would always increment s->read_pos in UARTDR read | ||
11 | handler even if FIFO was disabled, now we are limiting read_pos to not | ||
12 | exceed FIFO depth (read_pos itself is reset to 0 if user disables FIFO). | ||
13 | |||
14 | Signed-off-by: Evgeny Iakovlev <eiakovlev@linux.microsoft.com> | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
10 | [PMM: tweaked commit message as suggested by Igor] | 16 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
17 | Message-id: 20230123162304.26254-2-eiakovlev@linux.microsoft.com | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 19 | --- |
13 | hw/arm/raspi.c | 19 ++++++++++++++++--- | 20 | include/hw/char/pl011.h | 5 ++++- |
14 | 1 file changed, 16 insertions(+), 3 deletions(-) | 21 | hw/char/pl011.c | 30 ++++++++++++++++++------------ |
22 | 2 files changed, 22 insertions(+), 13 deletions(-) | ||
15 | 23 | ||
16 | diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c | 24 | diff --git a/include/hw/char/pl011.h b/include/hw/char/pl011.h |
17 | index XXXXXXX..XXXXXXX 100644 | 25 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/hw/arm/raspi.c | 26 | --- a/include/hw/char/pl011.h |
19 | +++ b/hw/arm/raspi.c | 27 | +++ b/include/hw/char/pl011.h |
20 | @@ -XXX,XX +XXX,XX @@ static const char *board_soc_type(uint32_t board_rev) | 28 | @@ -XXX,XX +XXX,XX @@ OBJECT_DECLARE_SIMPLE_TYPE(PL011State, PL011) |
21 | return soc_types[proc_id]; | 29 | /* This shares the same struct (and cast macro) as the base pl011 device */ |
30 | #define TYPE_PL011_LUMINARY "pl011_luminary" | ||
31 | |||
32 | +/* Depth of UART FIFO in bytes, when FIFO mode is enabled (else depth == 1) */ | ||
33 | +#define PL011_FIFO_DEPTH 16 | ||
34 | + | ||
35 | struct PL011State { | ||
36 | SysBusDevice parent_obj; | ||
37 | |||
38 | @@ -XXX,XX +XXX,XX @@ struct PL011State { | ||
39 | uint32_t dmacr; | ||
40 | uint32_t int_enabled; | ||
41 | uint32_t int_level; | ||
42 | - uint32_t read_fifo[16]; | ||
43 | + uint32_t read_fifo[PL011_FIFO_DEPTH]; | ||
44 | uint32_t ilpr; | ||
45 | uint32_t ibrd; | ||
46 | uint32_t fbrd; | ||
47 | diff --git a/hw/char/pl011.c b/hw/char/pl011.c | ||
48 | index XXXXXXX..XXXXXXX 100644 | ||
49 | --- a/hw/char/pl011.c | ||
50 | +++ b/hw/char/pl011.c | ||
51 | @@ -XXX,XX +XXX,XX @@ static void pl011_update(PL011State *s) | ||
52 | } | ||
22 | } | 53 | } |
23 | 54 | ||
24 | +static int cores_count(uint32_t board_rev) | 55 | +static bool pl011_is_fifo_enabled(PL011State *s) |
25 | +{ | 56 | +{ |
26 | + static const int soc_cores_count[] = { | 57 | + return (s->lcr & 0x10) != 0; |
27 | + 0, BCM283X_NCPUS, BCM283X_NCPUS, | ||
28 | + }; | ||
29 | + int proc_id = board_processor_id(board_rev); | ||
30 | + | ||
31 | + if (proc_id >= ARRAY_SIZE(soc_cores_count) || !soc_cores_count[proc_id]) { | ||
32 | + error_report("Unsupported processor id '%d' (board revision: 0x%x)", | ||
33 | + proc_id, board_rev); | ||
34 | + exit(1); | ||
35 | + } | ||
36 | + return soc_cores_count[proc_id]; | ||
37 | +} | 58 | +} |
38 | + | 59 | + |
39 | static const char *board_type(uint32_t board_rev) | 60 | +static inline unsigned pl011_get_fifo_depth(PL011State *s) |
61 | +{ | ||
62 | + /* Note: FIFO depth is expected to be power-of-2 */ | ||
63 | + return pl011_is_fifo_enabled(s) ? PL011_FIFO_DEPTH : 1; | ||
64 | +} | ||
65 | + | ||
66 | static uint64_t pl011_read(void *opaque, hwaddr offset, | ||
67 | unsigned size) | ||
40 | { | 68 | { |
41 | static const char *types[] = { | 69 | @@ -XXX,XX +XXX,XX @@ static uint64_t pl011_read(void *opaque, hwaddr offset, |
42 | @@ -XXX,XX +XXX,XX @@ static void raspi_machine_class_init(ObjectClass *oc, void *data) | 70 | c = s->read_fifo[s->read_pos]; |
43 | mc->no_parallel = 1; | 71 | if (s->read_count > 0) { |
44 | mc->no_floppy = 1; | 72 | s->read_count--; |
45 | mc->no_cdrom = 1; | 73 | - if (++s->read_pos == 16) |
46 | - mc->max_cpus = BCM283X_NCPUS; | 74 | - s->read_pos = 0; |
47 | - mc->min_cpus = BCM283X_NCPUS; | 75 | + s->read_pos = (s->read_pos + 1) & (pl011_get_fifo_depth(s) - 1); |
48 | - mc->default_cpus = BCM283X_NCPUS; | 76 | } |
49 | + mc->default_cpus = mc->min_cpus = mc->max_cpus = cores_count(board_rev); | 77 | if (s->read_count == 0) { |
50 | mc->default_ram_size = board_ram_size(board_rev); | 78 | s->flags |= PL011_FLAG_RXFE; |
51 | if (board_version(board_rev) == 2) { | 79 | @@ -XXX,XX +XXX,XX @@ static int pl011_can_receive(void *opaque) |
52 | mc->ignore_memory_transaction_failures = true; | 80 | PL011State *s = (PL011State *)opaque; |
81 | int r; | ||
82 | |||
83 | - if (s->lcr & 0x10) { | ||
84 | - r = s->read_count < 16; | ||
85 | - } else { | ||
86 | - r = s->read_count < 1; | ||
87 | - } | ||
88 | + r = s->read_count < pl011_get_fifo_depth(s); | ||
89 | trace_pl011_can_receive(s->lcr, s->read_count, r); | ||
90 | return r; | ||
91 | } | ||
92 | @@ -XXX,XX +XXX,XX @@ static void pl011_put_fifo(void *opaque, uint32_t value) | ||
93 | { | ||
94 | PL011State *s = (PL011State *)opaque; | ||
95 | int slot; | ||
96 | + unsigned pipe_depth; | ||
97 | |||
98 | - slot = s->read_pos + s->read_count; | ||
99 | - if (slot >= 16) | ||
100 | - slot -= 16; | ||
101 | + pipe_depth = pl011_get_fifo_depth(s); | ||
102 | + slot = (s->read_pos + s->read_count) & (pipe_depth - 1); | ||
103 | s->read_fifo[slot] = value; | ||
104 | s->read_count++; | ||
105 | s->flags &= ~PL011_FLAG_RXFE; | ||
106 | trace_pl011_put_fifo(value, s->read_count); | ||
107 | - if (!(s->lcr & 0x10) || s->read_count == 16) { | ||
108 | + if (s->read_count == pipe_depth) { | ||
109 | trace_pl011_put_fifo_full(); | ||
110 | s->flags |= PL011_FLAG_RXFF; | ||
111 | } | ||
112 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_pl011 = { | ||
113 | VMSTATE_UINT32(dmacr, PL011State), | ||
114 | VMSTATE_UINT32(int_enabled, PL011State), | ||
115 | VMSTATE_UINT32(int_level, PL011State), | ||
116 | - VMSTATE_UINT32_ARRAY(read_fifo, PL011State, 16), | ||
117 | + VMSTATE_UINT32_ARRAY(read_fifo, PL011State, PL011_FIFO_DEPTH), | ||
118 | VMSTATE_UINT32(ilpr, PL011State), | ||
119 | VMSTATE_UINT32(ibrd, PL011State), | ||
120 | VMSTATE_UINT32(fbrd, PL011State), | ||
53 | -- | 121 | -- |
54 | 2.20.1 | 122 | 2.34.1 |
55 | 123 | ||
56 | 124 | diff view generated by jsdifflib |
1 | From: Guenter Roeck <linux@roeck-us.net> | 1 | From: Evgeny Iakovlev <eiakovlev@linux.microsoft.com> |
---|---|---|---|
2 | 2 | ||
3 | Initialize EHCI controllers on AST2600 using the existing | 3 | Previous change slightly modified the way we handle data writes when |
4 | TYPE_PLATFORM_EHCI. After this change, booting ast2600-evb | 4 | FIFO is disabled. Previously we kept incrementing read_pos and were |
5 | into Linux successfully instantiates a USB interface after | 5 | storing data at that position, although we only have a |
6 | the necessary changes are made to its devicetree files. | 6 | single-register-deep FIFO now. Then we changed it to always store data |
7 | at pos 0. | ||
7 | 8 | ||
8 | ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver | 9 | If guest disables FIFO and the proceeds to read data, it will work out |
9 | ehci-platform: EHCI generic platform driver | 10 | fine, because we still read from current read_pos before setting it to |
10 | ehci-platform 1e6a3000.usb: EHCI Host Controller | 11 | 0. |
11 | ehci-platform 1e6a3000.usb: new USB bus registered, assigned bus number 1 | ||
12 | ehci-platform 1e6a3000.usb: irq 25, io mem 0x1e6a3000 | ||
13 | ehci-platform 1e6a3000.usb: USB 2.0 started, EHCI 1.00 | ||
14 | usb usb1: Manufacturer: Linux 5.5.0-09825-ga0802f2d0ef5-dirty ehci_hcd | ||
15 | usb 1-1: new high-speed USB device number 2 using ehci-platform | ||
16 | 12 | ||
17 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | 13 | However, to make code less fragile, introduce a post_load hook for |
18 | Signed-off-by: Guenter Roeck <linux@roeck-us.net> | 14 | PL011State and move fixup read FIFO state when FIFO is disabled. Since |
19 | Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com> | 15 | we are introducing a post_load hook, also do some sanity checking on |
20 | Message-id: 20200207174548.9087-1-linux@roeck-us.net | 16 | untrusted incoming input state. |
17 | |||
18 | Signed-off-by: Evgeny Iakovlev <eiakovlev@linux.microsoft.com> | ||
19 | Message-id: 20230123162304.26254-3-eiakovlev@linux.microsoft.com | ||
21 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 20 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
22 | --- | 21 | --- |
23 | hw/arm/aspeed_ast2600.c | 23 +++++++++++++++++++++++ | 22 | hw/char/pl011.c | 25 +++++++++++++++++++++++++ |
24 | 1 file changed, 23 insertions(+) | 23 | 1 file changed, 25 insertions(+) |
25 | 24 | ||
26 | diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c | 25 | diff --git a/hw/char/pl011.c b/hw/char/pl011.c |
27 | index XXXXXXX..XXXXXXX 100644 | 26 | index XXXXXXX..XXXXXXX 100644 |
28 | --- a/hw/arm/aspeed_ast2600.c | 27 | --- a/hw/char/pl011.c |
29 | +++ b/hw/arm/aspeed_ast2600.c | 28 | +++ b/hw/char/pl011.c |
30 | @@ -XXX,XX +XXX,XX @@ static const hwaddr aspeed_soc_ast2600_memmap[] = { | 29 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_pl011_clock = { |
31 | [ASPEED_FMC] = 0x1E620000, | ||
32 | [ASPEED_SPI1] = 0x1E630000, | ||
33 | [ASPEED_SPI2] = 0x1E641000, | ||
34 | + [ASPEED_EHCI1] = 0x1E6A1000, | ||
35 | + [ASPEED_EHCI2] = 0x1E6A3000, | ||
36 | [ASPEED_MII1] = 0x1E650000, | ||
37 | [ASPEED_MII2] = 0x1E650008, | ||
38 | [ASPEED_MII3] = 0x1E650010, | ||
39 | @@ -XXX,XX +XXX,XX @@ static const int aspeed_soc_ast2600_irqmap[] = { | ||
40 | [ASPEED_ADC] = 78, | ||
41 | [ASPEED_XDMA] = 6, | ||
42 | [ASPEED_SDHCI] = 43, | ||
43 | + [ASPEED_EHCI1] = 5, | ||
44 | + [ASPEED_EHCI2] = 9, | ||
45 | [ASPEED_EMMC] = 15, | ||
46 | [ASPEED_GPIO] = 40, | ||
47 | [ASPEED_GPIO_1_8V] = 11, | ||
48 | @@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2600_init(Object *obj) | ||
49 | sizeof(s->spi[i]), typename); | ||
50 | } | 30 | } |
51 | 31 | }; | |
52 | + for (i = 0; i < sc->ehcis_num; i++) { | 32 | |
53 | + sysbus_init_child_obj(obj, "ehci[*]", OBJECT(&s->ehci[i]), | 33 | +static int pl011_post_load(void *opaque, int version_id) |
54 | + sizeof(s->ehci[i]), TYPE_PLATFORM_EHCI); | 34 | +{ |
35 | + PL011State* s = opaque; | ||
36 | + | ||
37 | + /* Sanity-check input state */ | ||
38 | + if (s->read_pos >= ARRAY_SIZE(s->read_fifo) || | ||
39 | + s->read_count > ARRAY_SIZE(s->read_fifo)) { | ||
40 | + return -1; | ||
55 | + } | 41 | + } |
56 | + | 42 | + |
57 | snprintf(typename, sizeof(typename), "aspeed.sdmc-%s", socname); | 43 | + if (!pl011_is_fifo_enabled(s) && s->read_count > 0 && s->read_pos > 0) { |
58 | sysbus_init_child_obj(obj, "sdmc", OBJECT(&s->sdmc), sizeof(s->sdmc), | 44 | + /* |
59 | typename); | 45 | + * Older versions of PL011 didn't ensure that the single |
60 | @@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp) | 46 | + * character in the FIFO in FIFO-disabled mode is in |
61 | s->spi[i].ctrl->flash_window_base); | 47 | + * element 0 of the array; convert to follow the current |
62 | } | 48 | + * code's assumptions. |
63 | 49 | + */ | |
64 | + /* EHCI */ | 50 | + s->read_fifo[0] = s->read_fifo[s->read_pos]; |
65 | + for (i = 0; i < sc->ehcis_num; i++) { | 51 | + s->read_pos = 0; |
66 | + object_property_set_bool(OBJECT(&s->ehci[i]), true, "realized", &err); | ||
67 | + if (err) { | ||
68 | + error_propagate(errp, err); | ||
69 | + return; | ||
70 | + } | ||
71 | + sysbus_mmio_map(SYS_BUS_DEVICE(&s->ehci[i]), 0, | ||
72 | + sc->memmap[ASPEED_EHCI1 + i]); | ||
73 | + sysbus_connect_irq(SYS_BUS_DEVICE(&s->ehci[i]), 0, | ||
74 | + aspeed_soc_get_irq(s, ASPEED_EHCI1 + i)); | ||
75 | + } | 52 | + } |
76 | + | 53 | + |
77 | /* SDMC - SDRAM Memory Controller */ | 54 | + return 0; |
78 | object_property_set_bool(OBJECT(&s->sdmc), true, "realized", &err); | 55 | +} |
79 | if (err) { | 56 | + |
80 | @@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2600_class_init(ObjectClass *oc, void *data) | 57 | static const VMStateDescription vmstate_pl011 = { |
81 | sc->silicon_rev = AST2600_A0_SILICON_REV; | 58 | .name = "pl011", |
82 | sc->sram_size = 0x10000; | 59 | .version_id = 2, |
83 | sc->spis_num = 2; | 60 | .minimum_version_id = 2, |
84 | + sc->ehcis_num = 2; | 61 | + .post_load = pl011_post_load, |
85 | sc->wdts_num = 4; | 62 | .fields = (VMStateField[]) { |
86 | sc->macs_num = 4; | 63 | VMSTATE_UINT32(readbuff, PL011State), |
87 | sc->irqmap = aspeed_soc_ast2600_irqmap; | 64 | VMSTATE_UINT32(flags, PL011State), |
88 | -- | 65 | -- |
89 | 2.20.1 | 66 | 2.34.1 |
90 | |||
91 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Evgeny Iakovlev <eiakovlev@linux.microsoft.com> |
---|---|---|---|
2 | 2 | ||
3 | The board revision encode the model type. Add a helper | 3 | PL011 currently lacks a reset method. Implement it. |
4 | to extract the model, and use it. | ||
5 | 4 | ||
6 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 5 | Signed-off-by: Evgeny Iakovlev <eiakovlev@linux.microsoft.com> |
7 | Message-id: 20200208165645.15657-12-f4bug@amsat.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
8 | Message-id: 20230123162304.26254-4-eiakovlev@linux.microsoft.com | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 10 | --- |
11 | hw/arm/raspi.c | 18 ++++++++++++++++-- | 11 | hw/char/pl011.c | 26 +++++++++++++++++++++----- |
12 | 1 file changed, 16 insertions(+), 2 deletions(-) | 12 | 1 file changed, 21 insertions(+), 5 deletions(-) |
13 | 13 | ||
14 | diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c | 14 | diff --git a/hw/char/pl011.c b/hw/char/pl011.c |
15 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/arm/raspi.c | 16 | --- a/hw/char/pl011.c |
17 | +++ b/hw/arm/raspi.c | 17 | +++ b/hw/char/pl011.c |
18 | @@ -XXX,XX +XXX,XX @@ static const char *board_soc_type(uint32_t board_rev) | 18 | @@ -XXX,XX +XXX,XX @@ static void pl011_init(Object *obj) |
19 | return soc_types[proc_id]; | 19 | s->clk = qdev_init_clock_in(DEVICE(obj), "clk", pl011_clock_update, s, |
20 | ClockUpdate); | ||
21 | |||
22 | - s->read_trigger = 1; | ||
23 | - s->ifl = 0x12; | ||
24 | - s->cr = 0x300; | ||
25 | - s->flags = 0x90; | ||
26 | - | ||
27 | s->id = pl011_id_arm; | ||
20 | } | 28 | } |
21 | 29 | ||
22 | +static const char *board_type(uint32_t board_rev) | 30 | @@ -XXX,XX +XXX,XX @@ static void pl011_realize(DeviceState *dev, Error **errp) |
31 | pl011_event, NULL, s, NULL, true); | ||
32 | } | ||
33 | |||
34 | +static void pl011_reset(DeviceState *dev) | ||
23 | +{ | 35 | +{ |
24 | + static const char *types[] = { | 36 | + PL011State *s = PL011(dev); |
25 | + "A", "B", "A+", "B+", "2B", "Alpha", "CM1", NULL, "3B", "Zero", | 37 | + |
26 | + "CM3", NULL, "Zero W", "3B+", "3A+", NULL, "CM3+", "4B", | 38 | + s->lcr = 0; |
27 | + }; | 39 | + s->rsr = 0; |
28 | + assert(FIELD_EX32(board_rev, REV_CODE, STYLE)); /* Only new style */ | 40 | + s->dmacr = 0; |
29 | + int bt = FIELD_EX32(board_rev, REV_CODE, TYPE); | 41 | + s->int_enabled = 0; |
30 | + if (bt >= ARRAY_SIZE(types) || !types[bt]) { | 42 | + s->int_level = 0; |
31 | + return "Unknown"; | 43 | + s->ilpr = 0; |
32 | + } | 44 | + s->ibrd = 0; |
33 | + return types[bt]; | 45 | + s->fbrd = 0; |
46 | + s->read_pos = 0; | ||
47 | + s->read_count = 0; | ||
48 | + s->read_trigger = 1; | ||
49 | + s->ifl = 0x12; | ||
50 | + s->cr = 0x300; | ||
51 | + s->flags = 0x90; | ||
34 | +} | 52 | +} |
35 | + | 53 | + |
36 | static void write_smpboot(ARMCPU *cpu, const struct arm_boot_info *info) | 54 | static void pl011_class_init(ObjectClass *oc, void *data) |
37 | { | 55 | { |
38 | static const uint32_t smpboot[] = { | 56 | DeviceClass *dc = DEVICE_CLASS(oc); |
39 | @@ -XXX,XX +XXX,XX @@ static void raspi2_machine_class_init(ObjectClass *oc, void *data) | 57 | |
40 | uint32_t board_rev = (uint32_t)(uintptr_t)data; | 58 | dc->realize = pl011_realize; |
41 | 59 | + dc->reset = pl011_reset; | |
42 | rmc->board_rev = board_rev; | 60 | dc->vmsd = &vmstate_pl011; |
43 | - mc->desc = "Raspberry Pi 2B"; | 61 | device_class_set_props(dc, pl011_properties); |
44 | + mc->desc = g_strdup_printf("Raspberry Pi %s", board_type(board_rev)); | 62 | } |
45 | mc->init = raspi_machine_init; | ||
46 | mc->block_default_type = IF_SD; | ||
47 | mc->no_parallel = 1; | ||
48 | @@ -XXX,XX +XXX,XX @@ static void raspi3_machine_class_init(ObjectClass *oc, void *data) | ||
49 | uint32_t board_rev = (uint32_t)(uintptr_t)data; | ||
50 | |||
51 | rmc->board_rev = board_rev; | ||
52 | - mc->desc = "Raspberry Pi 3B"; | ||
53 | + mc->desc = g_strdup_printf("Raspberry Pi %s", board_type(board_rev)); | ||
54 | mc->init = raspi_machine_init; | ||
55 | mc->block_default_type = IF_SD; | ||
56 | mc->no_parallel = 1; | ||
57 | -- | 63 | -- |
58 | 2.20.1 | 64 | 2.34.1 |
59 | 65 | ||
60 | 66 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Evgeny Iakovlev <eiakovlev@linux.microsoft.com> |
---|---|---|---|
2 | 2 | ||
3 | raspi_machine_init() access to board_rev via RaspiMachineClass. | 3 | Current FIFO handling code does not reset RXFE/RXFF flags when guest |
4 | raspi2_init() and raspi3_init() do nothing. Call raspi_machine_init | 4 | resets FIFO by writing to UARTLCR register, although internal FIFO state |
5 | directly. | 5 | is reset to 0 read count. Actual guest-visible flag update will happen |
6 | only on next data read or write attempt. As a result of that any guest | ||
7 | that expects RXFE flag to be set (and RXFF to be cleared) after resetting | ||
8 | FIFO will never see that happen. | ||
6 | 9 | ||
7 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 10 | Signed-off-by: Evgeny Iakovlev <eiakovlev@linux.microsoft.com> |
8 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | 11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Message-id: 20200208165645.15657-10-f4bug@amsat.org | 12 | Message-id: 20230123162304.26254-5-eiakovlev@linux.microsoft.com |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 14 | --- |
12 | hw/arm/raspi.c | 16 +++------------- | 15 | hw/char/pl011.c | 18 +++++++++++++----- |
13 | 1 file changed, 3 insertions(+), 13 deletions(-) | 16 | 1 file changed, 13 insertions(+), 5 deletions(-) |
14 | 17 | ||
15 | diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c | 18 | diff --git a/hw/char/pl011.c b/hw/char/pl011.c |
16 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/raspi.c | 20 | --- a/hw/char/pl011.c |
18 | +++ b/hw/arm/raspi.c | 21 | +++ b/hw/char/pl011.c |
19 | @@ -XXX,XX +XXX,XX @@ static void setup_boot(MachineState *machine, int version, size_t ram_size) | 22 | @@ -XXX,XX +XXX,XX @@ static inline unsigned pl011_get_fifo_depth(PL011State *s) |
20 | arm_load_kernel(ARM_CPU(first_cpu), machine, &binfo); | 23 | return pl011_is_fifo_enabled(s) ? PL011_FIFO_DEPTH : 1; |
21 | } | 24 | } |
22 | 25 | ||
23 | -static void raspi_init(MachineState *machine) | 26 | +static inline void pl011_reset_fifo(PL011State *s) |
24 | +static void raspi_machine_init(MachineState *machine) | 27 | +{ |
28 | + s->read_count = 0; | ||
29 | + s->read_pos = 0; | ||
30 | + | ||
31 | + /* Reset FIFO flags */ | ||
32 | + s->flags &= ~(PL011_FLAG_RXFF | PL011_FLAG_TXFF); | ||
33 | + s->flags |= PL011_FLAG_RXFE | PL011_FLAG_TXFE; | ||
34 | +} | ||
35 | + | ||
36 | static uint64_t pl011_read(void *opaque, hwaddr offset, | ||
37 | unsigned size) | ||
25 | { | 38 | { |
26 | RaspiMachineClass *mc = RASPI_MACHINE_GET_CLASS(machine); | 39 | @@ -XXX,XX +XXX,XX @@ static void pl011_write(void *opaque, hwaddr offset, |
27 | RaspiMachineState *s = RASPI_MACHINE(machine); | 40 | case 11: /* UARTLCR_H */ |
28 | @@ -XXX,XX +XXX,XX @@ static void raspi_init(MachineState *machine) | 41 | /* Reset the FIFO state on FIFO enable or disable */ |
29 | setup_boot(machine, version, machine->ram_size - vcram_size); | 42 | if ((s->lcr ^ value) & 0x10) { |
43 | - s->read_count = 0; | ||
44 | - s->read_pos = 0; | ||
45 | + pl011_reset_fifo(s); | ||
46 | } | ||
47 | if ((s->lcr ^ value) & 0x1) { | ||
48 | int break_enable = value & 0x1; | ||
49 | @@ -XXX,XX +XXX,XX @@ static void pl011_reset(DeviceState *dev) | ||
50 | s->ilpr = 0; | ||
51 | s->ibrd = 0; | ||
52 | s->fbrd = 0; | ||
53 | - s->read_pos = 0; | ||
54 | - s->read_count = 0; | ||
55 | s->read_trigger = 1; | ||
56 | s->ifl = 0x12; | ||
57 | s->cr = 0x300; | ||
58 | - s->flags = 0x90; | ||
59 | + s->flags = 0; | ||
60 | + pl011_reset_fifo(s); | ||
30 | } | 61 | } |
31 | 62 | ||
32 | -static void raspi2_init(MachineState *machine) | 63 | static void pl011_class_init(ObjectClass *oc, void *data) |
33 | -{ | ||
34 | - raspi_init(machine); | ||
35 | -} | ||
36 | - | ||
37 | static void raspi2_machine_class_init(ObjectClass *oc, void *data) | ||
38 | { | ||
39 | MachineClass *mc = MACHINE_CLASS(oc); | ||
40 | @@ -XXX,XX +XXX,XX @@ static void raspi2_machine_class_init(ObjectClass *oc, void *data) | ||
41 | |||
42 | rmc->board_rev = board_rev; | ||
43 | mc->desc = "Raspberry Pi 2B"; | ||
44 | - mc->init = raspi2_init; | ||
45 | + mc->init = raspi_machine_init; | ||
46 | mc->block_default_type = IF_SD; | ||
47 | mc->no_parallel = 1; | ||
48 | mc->no_floppy = 1; | ||
49 | @@ -XXX,XX +XXX,XX @@ static void raspi2_machine_class_init(ObjectClass *oc, void *data) | ||
50 | }; | ||
51 | |||
52 | #ifdef TARGET_AARCH64 | ||
53 | -static void raspi3_init(MachineState *machine) | ||
54 | -{ | ||
55 | - raspi_init(machine); | ||
56 | -} | ||
57 | - | ||
58 | static void raspi3_machine_class_init(ObjectClass *oc, void *data) | ||
59 | { | ||
60 | MachineClass *mc = MACHINE_CLASS(oc); | ||
61 | @@ -XXX,XX +XXX,XX @@ static void raspi3_machine_class_init(ObjectClass *oc, void *data) | ||
62 | |||
63 | rmc->board_rev = board_rev; | ||
64 | mc->desc = "Raspberry Pi 3B"; | ||
65 | - mc->init = raspi3_init; | ||
66 | + mc->init = raspi_machine_init; | ||
67 | mc->block_default_type = IF_SD; | ||
68 | mc->no_parallel = 1; | ||
69 | mc->no_floppy = 1; | ||
70 | -- | 64 | -- |
71 | 2.20.1 | 65 | 2.34.1 |
72 | |||
73 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Alexander Graf <agraf@csgraf.de> |
---|---|---|---|
2 | 2 | ||
3 | The board revision encode the board version. Add a helper | 3 | We currently only support GICv2 emulation. To also support GICv3, we will |
4 | to extract the version, and use it. | 4 | need to pass a few system registers into their respective handler functions. |
5 | 5 | ||
6 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 6 | This patch adds support for HVF to call into the TCG callbacks for GICv3 |
7 | Message-id: 20200208165645.15657-4-f4bug@amsat.org | 7 | system register handlers. This is safe because the GICv3 TCG code is generic |
8 | as long as we limit ourselves to EL0 and EL1 - which are the only modes | ||
9 | supported by HVF. | ||
10 | |||
11 | To make sure nobody trips over that, we also annotate callbacks that don't | ||
12 | work in HVF mode, such as EL state change hooks. | ||
13 | |||
14 | With GICv3 support in place, we can run with more than 8 vCPUs. | ||
15 | |||
16 | Signed-off-by: Alexander Graf <agraf@csgraf.de> | ||
17 | Message-id: 20230128224459.70676-1-agraf@csgraf.de | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 18 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 20 | --- |
11 | hw/arm/raspi.c | 31 +++++++++++++++++++++++++++---- | 21 | hw/intc/arm_gicv3_cpuif.c | 16 +++- |
12 | 1 file changed, 27 insertions(+), 4 deletions(-) | 22 | target/arm/hvf/hvf.c | 151 ++++++++++++++++++++++++++++++++++++ |
13 | 23 | target/arm/hvf/trace-events | 2 + | |
14 | diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c | 24 | 3 files changed, 168 insertions(+), 1 deletion(-) |
25 | |||
26 | diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | 27 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/arm/raspi.c | 28 | --- a/hw/intc/arm_gicv3_cpuif.c |
17 | +++ b/hw/arm/raspi.c | 29 | +++ b/hw/intc/arm_gicv3_cpuif.c |
18 | @@ -XXX,XX +XXX,XX @@ | 30 | @@ -XXX,XX +XXX,XX @@ |
19 | #include "qapi/error.h" | 31 | #include "hw/irq.h" |
20 | #include "cpu.h" | 32 | #include "cpu.h" |
21 | #include "hw/arm/bcm2836.h" | 33 | #include "target/arm/cpregs.h" |
22 | +#include "hw/registerfields.h" | 34 | +#include "sysemu/tcg.h" |
23 | #include "qemu/error-report.h" | 35 | +#include "sysemu/qtest.h" |
24 | #include "hw/boards.h" | 36 | |
25 | #include "hw/loader.h" | 37 | /* |
26 | @@ -XXX,XX +XXX,XX @@ typedef struct RasPiState { | 38 | * Special case return value from hppvi_index(); must be larger than |
27 | MemoryRegion ram; | 39 | @@ -XXX,XX +XXX,XX @@ void gicv3_init_cpuif(GICv3State *s) |
28 | } RasPiState; | 40 | * which case we'd get the wrong value. |
29 | 41 | * So instead we define the regs with no ri->opaque info, and | |
30 | +/* | 42 | * get back to the GICv3CPUState from the CPUARMState. |
31 | + * Board revision codes: | 43 | + * |
32 | + * www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/ | 44 | + * These CP regs callbacks can be called from either TCG or HVF code. |
33 | + */ | 45 | */ |
34 | +FIELD(REV_CODE, REVISION, 0, 4); | 46 | define_arm_cp_regs(cpu, gicv3_cpuif_reginfo); |
35 | +FIELD(REV_CODE, TYPE, 4, 8); | 47 | |
36 | +FIELD(REV_CODE, PROCESSOR, 12, 4); | 48 | @@ -XXX,XX +XXX,XX @@ void gicv3_init_cpuif(GICv3State *s) |
37 | +FIELD(REV_CODE, MANUFACTURER, 16, 4); | 49 | define_arm_cp_regs(cpu, gicv3_cpuif_ich_apxr23_reginfo); |
38 | +FIELD(REV_CODE, MEMORY_SIZE, 20, 3); | 50 | } |
39 | +FIELD(REV_CODE, STYLE, 23, 1); | 51 | } |
40 | + | 52 | - arm_register_el_change_hook(cpu, gicv3_cpuif_el_change_hook, cs); |
41 | +static int board_processor_id(uint32_t board_rev) | 53 | + if (tcg_enabled() || qtest_enabled()) { |
54 | + /* | ||
55 | + * We can only trap EL changes with TCG. However the GIC interrupt | ||
56 | + * state only changes on EL changes involving EL2 or EL3, so for | ||
57 | + * the non-TCG case this is OK, as EL2 and EL3 can't exist. | ||
58 | + */ | ||
59 | + arm_register_el_change_hook(cpu, gicv3_cpuif_el_change_hook, cs); | ||
60 | + } else { | ||
61 | + assert(!arm_feature(&cpu->env, ARM_FEATURE_EL2)); | ||
62 | + assert(!arm_feature(&cpu->env, ARM_FEATURE_EL3)); | ||
63 | + } | ||
64 | } | ||
65 | } | ||
66 | diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c | ||
67 | index XXXXXXX..XXXXXXX 100644 | ||
68 | --- a/target/arm/hvf/hvf.c | ||
69 | +++ b/target/arm/hvf/hvf.c | ||
70 | @@ -XXX,XX +XXX,XX @@ | ||
71 | #define SYSREG_PMCCNTR_EL0 SYSREG(3, 3, 9, 13, 0) | ||
72 | #define SYSREG_PMCCFILTR_EL0 SYSREG(3, 3, 14, 15, 7) | ||
73 | |||
74 | +#define SYSREG_ICC_AP0R0_EL1 SYSREG(3, 0, 12, 8, 4) | ||
75 | +#define SYSREG_ICC_AP0R1_EL1 SYSREG(3, 0, 12, 8, 5) | ||
76 | +#define SYSREG_ICC_AP0R2_EL1 SYSREG(3, 0, 12, 8, 6) | ||
77 | +#define SYSREG_ICC_AP0R3_EL1 SYSREG(3, 0, 12, 8, 7) | ||
78 | +#define SYSREG_ICC_AP1R0_EL1 SYSREG(3, 0, 12, 9, 0) | ||
79 | +#define SYSREG_ICC_AP1R1_EL1 SYSREG(3, 0, 12, 9, 1) | ||
80 | +#define SYSREG_ICC_AP1R2_EL1 SYSREG(3, 0, 12, 9, 2) | ||
81 | +#define SYSREG_ICC_AP1R3_EL1 SYSREG(3, 0, 12, 9, 3) | ||
82 | +#define SYSREG_ICC_ASGI1R_EL1 SYSREG(3, 0, 12, 11, 6) | ||
83 | +#define SYSREG_ICC_BPR0_EL1 SYSREG(3, 0, 12, 8, 3) | ||
84 | +#define SYSREG_ICC_BPR1_EL1 SYSREG(3, 0, 12, 12, 3) | ||
85 | +#define SYSREG_ICC_CTLR_EL1 SYSREG(3, 0, 12, 12, 4) | ||
86 | +#define SYSREG_ICC_DIR_EL1 SYSREG(3, 0, 12, 11, 1) | ||
87 | +#define SYSREG_ICC_EOIR0_EL1 SYSREG(3, 0, 12, 8, 1) | ||
88 | +#define SYSREG_ICC_EOIR1_EL1 SYSREG(3, 0, 12, 12, 1) | ||
89 | +#define SYSREG_ICC_HPPIR0_EL1 SYSREG(3, 0, 12, 8, 2) | ||
90 | +#define SYSREG_ICC_HPPIR1_EL1 SYSREG(3, 0, 12, 12, 2) | ||
91 | +#define SYSREG_ICC_IAR0_EL1 SYSREG(3, 0, 12, 8, 0) | ||
92 | +#define SYSREG_ICC_IAR1_EL1 SYSREG(3, 0, 12, 12, 0) | ||
93 | +#define SYSREG_ICC_IGRPEN0_EL1 SYSREG(3, 0, 12, 12, 6) | ||
94 | +#define SYSREG_ICC_IGRPEN1_EL1 SYSREG(3, 0, 12, 12, 7) | ||
95 | +#define SYSREG_ICC_PMR_EL1 SYSREG(3, 0, 4, 6, 0) | ||
96 | +#define SYSREG_ICC_RPR_EL1 SYSREG(3, 0, 12, 11, 3) | ||
97 | +#define SYSREG_ICC_SGI0R_EL1 SYSREG(3, 0, 12, 11, 7) | ||
98 | +#define SYSREG_ICC_SGI1R_EL1 SYSREG(3, 0, 12, 11, 5) | ||
99 | +#define SYSREG_ICC_SRE_EL1 SYSREG(3, 0, 12, 12, 5) | ||
100 | + | ||
101 | #define WFX_IS_WFE (1 << 0) | ||
102 | |||
103 | #define TMR_CTL_ENABLE (1 << 0) | ||
104 | @@ -XXX,XX +XXX,XX @@ static bool is_id_sysreg(uint32_t reg) | ||
105 | SYSREG_CRM(reg) < 8; | ||
106 | } | ||
107 | |||
108 | +static uint32_t hvf_reg2cp_reg(uint32_t reg) | ||
42 | +{ | 109 | +{ |
43 | + assert(FIELD_EX32(board_rev, REV_CODE, STYLE)); /* Only new style */ | 110 | + return ENCODE_AA64_CP_REG(CP_REG_ARM64_SYSREG_CP, |
44 | + return FIELD_EX32(board_rev, REV_CODE, PROCESSOR); | 111 | + (reg >> SYSREG_CRN_SHIFT) & SYSREG_CRN_MASK, |
112 | + (reg >> SYSREG_CRM_SHIFT) & SYSREG_CRM_MASK, | ||
113 | + (reg >> SYSREG_OP0_SHIFT) & SYSREG_OP0_MASK, | ||
114 | + (reg >> SYSREG_OP1_SHIFT) & SYSREG_OP1_MASK, | ||
115 | + (reg >> SYSREG_OP2_SHIFT) & SYSREG_OP2_MASK); | ||
45 | +} | 116 | +} |
46 | + | 117 | + |
47 | +static int board_version(uint32_t board_rev) | 118 | +static bool hvf_sysreg_read_cp(CPUState *cpu, uint32_t reg, uint64_t *val) |
48 | +{ | 119 | +{ |
49 | + return board_processor_id(board_rev) + 1; | 120 | + ARMCPU *arm_cpu = ARM_CPU(cpu); |
121 | + CPUARMState *env = &arm_cpu->env; | ||
122 | + const ARMCPRegInfo *ri; | ||
123 | + | ||
124 | + ri = get_arm_cp_reginfo(arm_cpu->cp_regs, hvf_reg2cp_reg(reg)); | ||
125 | + if (ri) { | ||
126 | + if (ri->accessfn) { | ||
127 | + if (ri->accessfn(env, ri, true) != CP_ACCESS_OK) { | ||
128 | + return false; | ||
129 | + } | ||
130 | + } | ||
131 | + if (ri->type & ARM_CP_CONST) { | ||
132 | + *val = ri->resetvalue; | ||
133 | + } else if (ri->readfn) { | ||
134 | + *val = ri->readfn(env, ri); | ||
135 | + } else { | ||
136 | + *val = CPREG_FIELD64(env, ri); | ||
137 | + } | ||
138 | + trace_hvf_vgic_read(ri->name, *val); | ||
139 | + return true; | ||
140 | + } | ||
141 | + | ||
142 | + return false; | ||
50 | +} | 143 | +} |
51 | + | 144 | + |
52 | static void write_smpboot(ARMCPU *cpu, const struct arm_boot_info *info) | 145 | static int hvf_sysreg_read(CPUState *cpu, uint32_t reg, uint32_t rt) |
53 | { | 146 | { |
54 | static const uint32_t smpboot[] = { | 147 | ARMCPU *arm_cpu = ARM_CPU(cpu); |
55 | @@ -XXX,XX +XXX,XX @@ static void setup_boot(MachineState *machine, int version, size_t ram_size) | 148 | @@ -XXX,XX +XXX,XX @@ static int hvf_sysreg_read(CPUState *cpu, uint32_t reg, uint32_t rt) |
56 | arm_load_kernel(ARM_CPU(first_cpu), machine, &binfo); | 149 | case SYSREG_OSDLR_EL1: |
150 | /* Dummy register */ | ||
151 | break; | ||
152 | + case SYSREG_ICC_AP0R0_EL1: | ||
153 | + case SYSREG_ICC_AP0R1_EL1: | ||
154 | + case SYSREG_ICC_AP0R2_EL1: | ||
155 | + case SYSREG_ICC_AP0R3_EL1: | ||
156 | + case SYSREG_ICC_AP1R0_EL1: | ||
157 | + case SYSREG_ICC_AP1R1_EL1: | ||
158 | + case SYSREG_ICC_AP1R2_EL1: | ||
159 | + case SYSREG_ICC_AP1R3_EL1: | ||
160 | + case SYSREG_ICC_ASGI1R_EL1: | ||
161 | + case SYSREG_ICC_BPR0_EL1: | ||
162 | + case SYSREG_ICC_BPR1_EL1: | ||
163 | + case SYSREG_ICC_DIR_EL1: | ||
164 | + case SYSREG_ICC_EOIR0_EL1: | ||
165 | + case SYSREG_ICC_EOIR1_EL1: | ||
166 | + case SYSREG_ICC_HPPIR0_EL1: | ||
167 | + case SYSREG_ICC_HPPIR1_EL1: | ||
168 | + case SYSREG_ICC_IAR0_EL1: | ||
169 | + case SYSREG_ICC_IAR1_EL1: | ||
170 | + case SYSREG_ICC_IGRPEN0_EL1: | ||
171 | + case SYSREG_ICC_IGRPEN1_EL1: | ||
172 | + case SYSREG_ICC_PMR_EL1: | ||
173 | + case SYSREG_ICC_SGI0R_EL1: | ||
174 | + case SYSREG_ICC_SGI1R_EL1: | ||
175 | + case SYSREG_ICC_SRE_EL1: | ||
176 | + case SYSREG_ICC_CTLR_EL1: | ||
177 | + /* Call the TCG sysreg handler. This is only safe for GICv3 regs. */ | ||
178 | + if (!hvf_sysreg_read_cp(cpu, reg, &val)) { | ||
179 | + hvf_raise_exception(cpu, EXCP_UDEF, syn_uncategorized()); | ||
180 | + } | ||
181 | + break; | ||
182 | default: | ||
183 | if (is_id_sysreg(reg)) { | ||
184 | /* ID system registers read as RES0 */ | ||
185 | @@ -XXX,XX +XXX,XX @@ static void pmswinc_write(CPUARMState *env, uint64_t value) | ||
186 | } | ||
57 | } | 187 | } |
58 | 188 | ||
59 | -static void raspi_init(MachineState *machine, int version) | 189 | +static bool hvf_sysreg_write_cp(CPUState *cpu, uint32_t reg, uint64_t val) |
60 | +static void raspi_init(MachineState *machine, uint32_t board_rev) | 190 | +{ |
191 | + ARMCPU *arm_cpu = ARM_CPU(cpu); | ||
192 | + CPUARMState *env = &arm_cpu->env; | ||
193 | + const ARMCPRegInfo *ri; | ||
194 | + | ||
195 | + ri = get_arm_cp_reginfo(arm_cpu->cp_regs, hvf_reg2cp_reg(reg)); | ||
196 | + | ||
197 | + if (ri) { | ||
198 | + if (ri->accessfn) { | ||
199 | + if (ri->accessfn(env, ri, false) != CP_ACCESS_OK) { | ||
200 | + return false; | ||
201 | + } | ||
202 | + } | ||
203 | + if (ri->writefn) { | ||
204 | + ri->writefn(env, ri, val); | ||
205 | + } else { | ||
206 | + CPREG_FIELD64(env, ri) = val; | ||
207 | + } | ||
208 | + | ||
209 | + trace_hvf_vgic_write(ri->name, val); | ||
210 | + return true; | ||
211 | + } | ||
212 | + | ||
213 | + return false; | ||
214 | +} | ||
215 | + | ||
216 | static int hvf_sysreg_write(CPUState *cpu, uint32_t reg, uint64_t val) | ||
61 | { | 217 | { |
62 | RasPiState *s = g_new0(RasPiState, 1); | 218 | ARMCPU *arm_cpu = ARM_CPU(cpu); |
63 | + int version = board_version(board_rev); | 219 | @@ -XXX,XX +XXX,XX @@ static int hvf_sysreg_write(CPUState *cpu, uint32_t reg, uint64_t val) |
64 | uint32_t vcram_size; | 220 | case SYSREG_OSDLR_EL1: |
65 | DriveInfo *di; | 221 | /* Dummy register */ |
66 | BlockBackend *blk; | 222 | break; |
67 | @@ -XXX,XX +XXX,XX @@ static void raspi_init(MachineState *machine, int version) | 223 | + case SYSREG_ICC_AP0R0_EL1: |
68 | /* Setup the SOC */ | 224 | + case SYSREG_ICC_AP0R1_EL1: |
69 | object_property_add_const_link(OBJECT(&s->soc), "ram", OBJECT(&s->ram), | 225 | + case SYSREG_ICC_AP0R2_EL1: |
70 | &error_abort); | 226 | + case SYSREG_ICC_AP0R3_EL1: |
71 | - int board_rev = version == 3 ? 0xa02082 : 0xa21041; | 227 | + case SYSREG_ICC_AP1R0_EL1: |
72 | object_property_set_int(OBJECT(&s->soc), board_rev, "board-rev", | 228 | + case SYSREG_ICC_AP1R1_EL1: |
73 | &error_abort); | 229 | + case SYSREG_ICC_AP1R2_EL1: |
74 | object_property_set_bool(OBJECT(&s->soc), true, "realized", &error_abort); | 230 | + case SYSREG_ICC_AP1R3_EL1: |
75 | @@ -XXX,XX +XXX,XX @@ static void raspi_init(MachineState *machine, int version) | 231 | + case SYSREG_ICC_ASGI1R_EL1: |
76 | 232 | + case SYSREG_ICC_BPR0_EL1: | |
77 | static void raspi2_init(MachineState *machine) | 233 | + case SYSREG_ICC_BPR1_EL1: |
78 | { | 234 | + case SYSREG_ICC_CTLR_EL1: |
79 | - raspi_init(machine, 2); | 235 | + case SYSREG_ICC_DIR_EL1: |
80 | + raspi_init(machine, 0xa21041); | 236 | + case SYSREG_ICC_EOIR0_EL1: |
81 | } | 237 | + case SYSREG_ICC_EOIR1_EL1: |
82 | 238 | + case SYSREG_ICC_HPPIR0_EL1: | |
83 | static void raspi2_machine_init(MachineClass *mc) | 239 | + case SYSREG_ICC_HPPIR1_EL1: |
84 | @@ -XXX,XX +XXX,XX @@ DEFINE_MACHINE("raspi2", raspi2_machine_init) | 240 | + case SYSREG_ICC_IAR0_EL1: |
85 | #ifdef TARGET_AARCH64 | 241 | + case SYSREG_ICC_IAR1_EL1: |
86 | static void raspi3_init(MachineState *machine) | 242 | + case SYSREG_ICC_IGRPEN0_EL1: |
87 | { | 243 | + case SYSREG_ICC_IGRPEN1_EL1: |
88 | - raspi_init(machine, 3); | 244 | + case SYSREG_ICC_PMR_EL1: |
89 | + raspi_init(machine, 0xa02082); | 245 | + case SYSREG_ICC_SGI0R_EL1: |
90 | } | 246 | + case SYSREG_ICC_SGI1R_EL1: |
91 | 247 | + case SYSREG_ICC_SRE_EL1: | |
92 | static void raspi3_machine_init(MachineClass *mc) | 248 | + /* Call the TCG sysreg handler. This is only safe for GICv3 regs. */ |
249 | + if (!hvf_sysreg_write_cp(cpu, reg, val)) { | ||
250 | + hvf_raise_exception(cpu, EXCP_UDEF, syn_uncategorized()); | ||
251 | + } | ||
252 | + break; | ||
253 | default: | ||
254 | cpu_synchronize_state(cpu); | ||
255 | trace_hvf_unhandled_sysreg_write(env->pc, reg, | ||
256 | diff --git a/target/arm/hvf/trace-events b/target/arm/hvf/trace-events | ||
257 | index XXXXXXX..XXXXXXX 100644 | ||
258 | --- a/target/arm/hvf/trace-events | ||
259 | +++ b/target/arm/hvf/trace-events | ||
260 | @@ -XXX,XX +XXX,XX @@ hvf_unknown_hvc(uint64_t x0) "unknown HVC! 0x%016"PRIx64 | ||
261 | hvf_unknown_smc(uint64_t x0) "unknown SMC! 0x%016"PRIx64 | ||
262 | hvf_exit(uint64_t syndrome, uint32_t ec, uint64_t pc) "exit: 0x%"PRIx64" [ec=0x%x pc=0x%"PRIx64"]" | ||
263 | hvf_psci_call(uint64_t x0, uint64_t x1, uint64_t x2, uint64_t x3, uint32_t cpuid) "PSCI Call x0=0x%016"PRIx64" x1=0x%016"PRIx64" x2=0x%016"PRIx64" x3=0x%016"PRIx64" cpu=0x%x" | ||
264 | +hvf_vgic_write(const char *name, uint64_t val) "vgic write to %s [val=0x%016"PRIx64"]" | ||
265 | +hvf_vgic_read(const char *name, uint64_t val) "vgic read from %s [val=0x%016"PRIx64"]" | ||
93 | -- | 266 | -- |
94 | 2.20.1 | 267 | 2.34.1 |
95 | |||
96 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Alexander Graf <agraf@csgraf.de> |
---|---|---|---|
2 | 2 | ||
3 | Use this along the exception return path, where we previously | 3 | Up to now, the finalize_gic_version() code open coded what is essentially |
4 | accepted any values. | 4 | a support bitmap match between host/emulation environment and desired |
5 | 5 | target GIC type. | |
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 6 | |
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 7 | This open coding leads to undesirable side effects. For example, a VM with |
8 | Message-id: 20200208125816.14954-11-richard.henderson@linaro.org | 8 | KVM and -smp 10 will automatically choose GICv3 while the same command |
9 | line with TCG will stay on GICv2 and fail the launch. | ||
10 | |||
11 | This patch combines the TCG and KVM matching code paths by making | ||
12 | everything a 2 pass process. First, we determine which GIC versions the | ||
13 | current environment is able to support, then we go through a single | ||
14 | state machine to determine which target GIC mode that means for us. | ||
15 | |||
16 | After this patch, the only user noticable changes should be consolidated | ||
17 | error messages as well as TCG -M virt supporting -smp > 8 automatically. | ||
18 | |||
19 | Signed-off-by: Alexander Graf <agraf@csgraf.de> | ||
20 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
21 | Reviewed-by: Cornelia Huck <cohuck@redhat.com> | ||
22 | Reviewed-by: Zenghui Yu <yuzenghui@huawei.com> | ||
23 | Message-id: 20221223090107.98888-2-agraf@csgraf.de | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 24 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 25 | --- |
11 | target/arm/internals.h | 12 ++++++++++++ | 26 | include/hw/arm/virt.h | 15 ++-- |
12 | target/arm/helper-a64.c | 1 + | 27 | hw/arm/virt.c | 198 ++++++++++++++++++++++-------------------- |
13 | 2 files changed, 13 insertions(+) | 28 | 2 files changed, 112 insertions(+), 101 deletions(-) |
14 | 29 | ||
15 | diff --git a/target/arm/internals.h b/target/arm/internals.h | 30 | diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h |
16 | index XXXXXXX..XXXXXXX 100644 | 31 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/internals.h | 32 | --- a/include/hw/arm/virt.h |
18 | +++ b/target/arm/internals.h | 33 | +++ b/include/hw/arm/virt.h |
19 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t aarch32_cpsr_valid_mask(uint64_t features, | 34 | @@ -XXX,XX +XXX,XX @@ typedef enum VirtMSIControllerType { |
20 | return valid; | 35 | } VirtMSIControllerType; |
36 | |||
37 | typedef enum VirtGICType { | ||
38 | - VIRT_GIC_VERSION_MAX, | ||
39 | - VIRT_GIC_VERSION_HOST, | ||
40 | - VIRT_GIC_VERSION_2, | ||
41 | - VIRT_GIC_VERSION_3, | ||
42 | - VIRT_GIC_VERSION_4, | ||
43 | + VIRT_GIC_VERSION_MAX = 0, | ||
44 | + VIRT_GIC_VERSION_HOST = 1, | ||
45 | + /* The concrete GIC values have to match the GIC version number */ | ||
46 | + VIRT_GIC_VERSION_2 = 2, | ||
47 | + VIRT_GIC_VERSION_3 = 3, | ||
48 | + VIRT_GIC_VERSION_4 = 4, | ||
49 | VIRT_GIC_VERSION_NOSEL, | ||
50 | } VirtGICType; | ||
51 | |||
52 | +#define VIRT_GIC_VERSION_2_MASK BIT(VIRT_GIC_VERSION_2) | ||
53 | +#define VIRT_GIC_VERSION_3_MASK BIT(VIRT_GIC_VERSION_3) | ||
54 | +#define VIRT_GIC_VERSION_4_MASK BIT(VIRT_GIC_VERSION_4) | ||
55 | + | ||
56 | struct VirtMachineClass { | ||
57 | MachineClass parent; | ||
58 | bool disallow_affinity_adjustment; | ||
59 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
60 | index XXXXXXX..XXXXXXX 100644 | ||
61 | --- a/hw/arm/virt.c | ||
62 | +++ b/hw/arm/virt.c | ||
63 | @@ -XXX,XX +XXX,XX @@ static void virt_set_memmap(VirtMachineState *vms, int pa_bits) | ||
64 | } | ||
21 | } | 65 | } |
22 | 66 | ||
23 | +static inline uint32_t aarch64_pstate_valid_mask(const ARMISARegisters *id) | 67 | +static VirtGICType finalize_gic_version_do(const char *accel_name, |
68 | + VirtGICType gic_version, | ||
69 | + int gics_supported, | ||
70 | + unsigned int max_cpus) | ||
24 | +{ | 71 | +{ |
25 | + uint32_t valid; | 72 | + /* Convert host/max/nosel to GIC version number */ |
26 | + | 73 | + switch (gic_version) { |
27 | + valid = PSTATE_M | PSTATE_DAIF | PSTATE_IL | PSTATE_SS | PSTATE_NZCV; | 74 | + case VIRT_GIC_VERSION_HOST: |
28 | + if (isar_feature_aa64_bti(id)) { | 75 | + if (!kvm_enabled()) { |
29 | + valid |= PSTATE_BTYPE; | 76 | + error_report("gic-version=host requires KVM"); |
77 | + exit(1); | ||
78 | + } | ||
79 | + | ||
80 | + /* For KVM, gic-version=host means gic-version=max */ | ||
81 | + return finalize_gic_version_do(accel_name, VIRT_GIC_VERSION_MAX, | ||
82 | + gics_supported, max_cpus); | ||
83 | + case VIRT_GIC_VERSION_MAX: | ||
84 | + if (gics_supported & VIRT_GIC_VERSION_4_MASK) { | ||
85 | + gic_version = VIRT_GIC_VERSION_4; | ||
86 | + } else if (gics_supported & VIRT_GIC_VERSION_3_MASK) { | ||
87 | + gic_version = VIRT_GIC_VERSION_3; | ||
88 | + } else { | ||
89 | + gic_version = VIRT_GIC_VERSION_2; | ||
90 | + } | ||
91 | + break; | ||
92 | + case VIRT_GIC_VERSION_NOSEL: | ||
93 | + if ((gics_supported & VIRT_GIC_VERSION_2_MASK) && | ||
94 | + max_cpus <= GIC_NCPU) { | ||
95 | + gic_version = VIRT_GIC_VERSION_2; | ||
96 | + } else if (gics_supported & VIRT_GIC_VERSION_3_MASK) { | ||
97 | + /* | ||
98 | + * in case the host does not support v2 emulation or | ||
99 | + * the end-user requested more than 8 VCPUs we now default | ||
100 | + * to v3. In any case defaulting to v2 would be broken. | ||
101 | + */ | ||
102 | + gic_version = VIRT_GIC_VERSION_3; | ||
103 | + } else if (max_cpus > GIC_NCPU) { | ||
104 | + error_report("%s only supports GICv2 emulation but more than 8 " | ||
105 | + "vcpus are requested", accel_name); | ||
106 | + exit(1); | ||
107 | + } | ||
108 | + break; | ||
109 | + case VIRT_GIC_VERSION_2: | ||
110 | + case VIRT_GIC_VERSION_3: | ||
111 | + case VIRT_GIC_VERSION_4: | ||
112 | + break; | ||
30 | + } | 113 | + } |
31 | + | 114 | + |
32 | + return valid; | 115 | + /* Check chosen version is effectively supported */ |
116 | + switch (gic_version) { | ||
117 | + case VIRT_GIC_VERSION_2: | ||
118 | + if (!(gics_supported & VIRT_GIC_VERSION_2_MASK)) { | ||
119 | + error_report("%s does not support GICv2 emulation", accel_name); | ||
120 | + exit(1); | ||
121 | + } | ||
122 | + break; | ||
123 | + case VIRT_GIC_VERSION_3: | ||
124 | + if (!(gics_supported & VIRT_GIC_VERSION_3_MASK)) { | ||
125 | + error_report("%s does not support GICv3 emulation", accel_name); | ||
126 | + exit(1); | ||
127 | + } | ||
128 | + break; | ||
129 | + case VIRT_GIC_VERSION_4: | ||
130 | + if (!(gics_supported & VIRT_GIC_VERSION_4_MASK)) { | ||
131 | + error_report("%s does not support GICv4 emulation, is virtualization=on?", | ||
132 | + accel_name); | ||
133 | + exit(1); | ||
134 | + } | ||
135 | + break; | ||
136 | + default: | ||
137 | + error_report("logic error in finalize_gic_version"); | ||
138 | + exit(1); | ||
139 | + break; | ||
140 | + } | ||
141 | + | ||
142 | + return gic_version; | ||
33 | +} | 143 | +} |
34 | + | 144 | + |
35 | /* | 145 | /* |
36 | * Parameters of a given virtual address, as extracted from the | 146 | * finalize_gic_version - Determines the final gic_version |
37 | * translation control register (TCR) for a given regime. | 147 | * according to the gic-version property |
38 | diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c | 148 | @@ -XXX,XX +XXX,XX @@ static void virt_set_memmap(VirtMachineState *vms, int pa_bits) |
39 | index XXXXXXX..XXXXXXX 100644 | 149 | */ |
40 | --- a/target/arm/helper-a64.c | 150 | static void finalize_gic_version(VirtMachineState *vms) |
41 | +++ b/target/arm/helper-a64.c | 151 | { |
42 | @@ -XXX,XX +XXX,XX @@ void HELPER(exception_return)(CPUARMState *env, uint64_t new_pc) | 152 | + const char *accel_name = current_accel_name(); |
43 | cur_el, new_el, env->regs[15]); | 153 | unsigned int max_cpus = MACHINE(vms)->smp.max_cpus; |
44 | } else { | 154 | + int gics_supported = 0; |
45 | env->aarch64 = 1; | 155 | |
46 | + spsr &= aarch64_pstate_valid_mask(&env_archcpu(env)->isar); | 156 | - if (kvm_enabled()) { |
47 | pstate_write(env, spsr); | 157 | - int probe_bitmap; |
48 | if (!arm_singlestep_active(env)) { | 158 | + /* Determine which GIC versions the current environment supports */ |
49 | env->pstate &= ~PSTATE_SS; | 159 | + if (kvm_enabled() && kvm_irqchip_in_kernel()) { |
160 | + int probe_bitmap = kvm_arm_vgic_probe(); | ||
161 | |||
162 | - if (!kvm_irqchip_in_kernel()) { | ||
163 | - switch (vms->gic_version) { | ||
164 | - case VIRT_GIC_VERSION_HOST: | ||
165 | - warn_report( | ||
166 | - "gic-version=host not relevant with kernel-irqchip=off " | ||
167 | - "as only userspace GICv2 is supported. Using v2 ..."); | ||
168 | - return; | ||
169 | - case VIRT_GIC_VERSION_MAX: | ||
170 | - case VIRT_GIC_VERSION_NOSEL: | ||
171 | - vms->gic_version = VIRT_GIC_VERSION_2; | ||
172 | - return; | ||
173 | - case VIRT_GIC_VERSION_2: | ||
174 | - return; | ||
175 | - case VIRT_GIC_VERSION_3: | ||
176 | - error_report( | ||
177 | - "gic-version=3 is not supported with kernel-irqchip=off"); | ||
178 | - exit(1); | ||
179 | - case VIRT_GIC_VERSION_4: | ||
180 | - error_report( | ||
181 | - "gic-version=4 is not supported with kernel-irqchip=off"); | ||
182 | - exit(1); | ||
183 | - } | ||
184 | - } | ||
185 | - | ||
186 | - probe_bitmap = kvm_arm_vgic_probe(); | ||
187 | if (!probe_bitmap) { | ||
188 | error_report("Unable to determine GIC version supported by host"); | ||
189 | exit(1); | ||
190 | } | ||
191 | |||
192 | - switch (vms->gic_version) { | ||
193 | - case VIRT_GIC_VERSION_HOST: | ||
194 | - case VIRT_GIC_VERSION_MAX: | ||
195 | - if (probe_bitmap & KVM_ARM_VGIC_V3) { | ||
196 | - vms->gic_version = VIRT_GIC_VERSION_3; | ||
197 | - } else { | ||
198 | - vms->gic_version = VIRT_GIC_VERSION_2; | ||
199 | - } | ||
200 | - return; | ||
201 | - case VIRT_GIC_VERSION_NOSEL: | ||
202 | - if ((probe_bitmap & KVM_ARM_VGIC_V2) && max_cpus <= GIC_NCPU) { | ||
203 | - vms->gic_version = VIRT_GIC_VERSION_2; | ||
204 | - } else if (probe_bitmap & KVM_ARM_VGIC_V3) { | ||
205 | - /* | ||
206 | - * in case the host does not support v2 in-kernel emulation or | ||
207 | - * the end-user requested more than 8 VCPUs we now default | ||
208 | - * to v3. In any case defaulting to v2 would be broken. | ||
209 | - */ | ||
210 | - vms->gic_version = VIRT_GIC_VERSION_3; | ||
211 | - } else if (max_cpus > GIC_NCPU) { | ||
212 | - error_report("host only supports in-kernel GICv2 emulation " | ||
213 | - "but more than 8 vcpus are requested"); | ||
214 | - exit(1); | ||
215 | - } | ||
216 | - break; | ||
217 | - case VIRT_GIC_VERSION_2: | ||
218 | - case VIRT_GIC_VERSION_3: | ||
219 | - break; | ||
220 | - case VIRT_GIC_VERSION_4: | ||
221 | - error_report("gic-version=4 is not supported with KVM"); | ||
222 | - exit(1); | ||
223 | + if (probe_bitmap & KVM_ARM_VGIC_V2) { | ||
224 | + gics_supported |= VIRT_GIC_VERSION_2_MASK; | ||
225 | } | ||
226 | - | ||
227 | - /* Check chosen version is effectively supported by the host */ | ||
228 | - if (vms->gic_version == VIRT_GIC_VERSION_2 && | ||
229 | - !(probe_bitmap & KVM_ARM_VGIC_V2)) { | ||
230 | - error_report("host does not support in-kernel GICv2 emulation"); | ||
231 | - exit(1); | ||
232 | - } else if (vms->gic_version == VIRT_GIC_VERSION_3 && | ||
233 | - !(probe_bitmap & KVM_ARM_VGIC_V3)) { | ||
234 | - error_report("host does not support in-kernel GICv3 emulation"); | ||
235 | - exit(1); | ||
236 | + if (probe_bitmap & KVM_ARM_VGIC_V3) { | ||
237 | + gics_supported |= VIRT_GIC_VERSION_3_MASK; | ||
238 | } | ||
239 | - return; | ||
240 | - } | ||
241 | - | ||
242 | - /* TCG mode */ | ||
243 | - switch (vms->gic_version) { | ||
244 | - case VIRT_GIC_VERSION_NOSEL: | ||
245 | - vms->gic_version = VIRT_GIC_VERSION_2; | ||
246 | - break; | ||
247 | - case VIRT_GIC_VERSION_MAX: | ||
248 | + } else if (kvm_enabled() && !kvm_irqchip_in_kernel()) { | ||
249 | + /* KVM w/o kernel irqchip can only deal with GICv2 */ | ||
250 | + gics_supported |= VIRT_GIC_VERSION_2_MASK; | ||
251 | + accel_name = "KVM with kernel-irqchip=off"; | ||
252 | + } else { | ||
253 | + gics_supported |= VIRT_GIC_VERSION_2_MASK; | ||
254 | if (module_object_class_by_name("arm-gicv3")) { | ||
255 | - /* CONFIG_ARM_GICV3_TCG was set */ | ||
256 | + gics_supported |= VIRT_GIC_VERSION_3_MASK; | ||
257 | if (vms->virt) { | ||
258 | /* GICv4 only makes sense if CPU has EL2 */ | ||
259 | - vms->gic_version = VIRT_GIC_VERSION_4; | ||
260 | - } else { | ||
261 | - vms->gic_version = VIRT_GIC_VERSION_3; | ||
262 | + gics_supported |= VIRT_GIC_VERSION_4_MASK; | ||
263 | } | ||
264 | - } else { | ||
265 | - vms->gic_version = VIRT_GIC_VERSION_2; | ||
266 | } | ||
267 | - break; | ||
268 | - case VIRT_GIC_VERSION_HOST: | ||
269 | - error_report("gic-version=host requires KVM"); | ||
270 | - exit(1); | ||
271 | - case VIRT_GIC_VERSION_4: | ||
272 | - if (!vms->virt) { | ||
273 | - error_report("gic-version=4 requires virtualization enabled"); | ||
274 | - exit(1); | ||
275 | - } | ||
276 | - break; | ||
277 | - case VIRT_GIC_VERSION_2: | ||
278 | - case VIRT_GIC_VERSION_3: | ||
279 | - break; | ||
280 | } | ||
281 | + | ||
282 | + /* | ||
283 | + * Then convert helpers like host/max to concrete GIC versions and ensure | ||
284 | + * the desired version is supported | ||
285 | + */ | ||
286 | + vms->gic_version = finalize_gic_version_do(accel_name, vms->gic_version, | ||
287 | + gics_supported, max_cpus); | ||
288 | } | ||
289 | |||
290 | /* | ||
50 | -- | 291 | -- |
51 | 2.20.1 | 292 | 2.34.1 |
52 | |||
53 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Alexander Graf <agraf@csgraf.de> |
---|---|---|---|
2 | 2 | ||
3 | There is no point in creating the SoC object before allocating the RAM. | 3 | Let's explicitly list out all accelerators that we support when trying to |
4 | Move the call to keep all the SoC-related calls together. | 4 | determine the supported set of GIC versions. KVM was already separate, so |
5 | the only missing one is HVF which simply reuses all of TCG's emulation | ||
6 | code and thus has the same compatibility matrix. | ||
5 | 7 | ||
6 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 8 | Signed-off-by: Alexander Graf <agraf@csgraf.de> |
7 | Acked-by: Igor Mammedov <imammedo@redhat.com> | 9 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
8 | Message-id: 20200208165645.15657-7-f4bug@amsat.org | 10 | Reviewed-by: Cornelia Huck <cohuck@redhat.com> |
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Reviewed-by: Zenghui Yu <yuzenghui@huawei.com> |
12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
13 | Message-id: 20221223090107.98888-3-agraf@csgraf.de | ||
14 | [PMM: Added qtest to the list of accelerators] | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 16 | --- |
12 | hw/arm/raspi.c | 5 ++--- | 17 | hw/arm/virt.c | 7 ++++++- |
13 | 1 file changed, 2 insertions(+), 3 deletions(-) | 18 | 1 file changed, 6 insertions(+), 1 deletion(-) |
14 | 19 | ||
15 | diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c | 20 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c |
16 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/raspi.c | 22 | --- a/hw/arm/virt.c |
18 | +++ b/hw/arm/raspi.c | 23 | +++ b/hw/arm/virt.c |
19 | @@ -XXX,XX +XXX,XX @@ static void raspi_init(MachineState *machine, uint32_t board_rev) | 24 | @@ -XXX,XX +XXX,XX @@ |
20 | exit(1); | 25 | #include "sysemu/numa.h" |
26 | #include "sysemu/runstate.h" | ||
27 | #include "sysemu/tpm.h" | ||
28 | +#include "sysemu/tcg.h" | ||
29 | #include "sysemu/kvm.h" | ||
30 | #include "sysemu/hvf.h" | ||
31 | +#include "sysemu/qtest.h" | ||
32 | #include "hw/loader.h" | ||
33 | #include "qapi/error.h" | ||
34 | #include "qemu/bitops.h" | ||
35 | @@ -XXX,XX +XXX,XX @@ static void finalize_gic_version(VirtMachineState *vms) | ||
36 | /* KVM w/o kernel irqchip can only deal with GICv2 */ | ||
37 | gics_supported |= VIRT_GIC_VERSION_2_MASK; | ||
38 | accel_name = "KVM with kernel-irqchip=off"; | ||
39 | - } else { | ||
40 | + } else if (tcg_enabled() || hvf_enabled() || qtest_enabled()) { | ||
41 | gics_supported |= VIRT_GIC_VERSION_2_MASK; | ||
42 | if (module_object_class_by_name("arm-gicv3")) { | ||
43 | gics_supported |= VIRT_GIC_VERSION_3_MASK; | ||
44 | @@ -XXX,XX +XXX,XX @@ static void finalize_gic_version(VirtMachineState *vms) | ||
45 | gics_supported |= VIRT_GIC_VERSION_4_MASK; | ||
46 | } | ||
47 | } | ||
48 | + } else { | ||
49 | + error_report("Unsupported accelerator, can not determine GIC support"); | ||
50 | + exit(1); | ||
21 | } | 51 | } |
22 | 52 | ||
23 | - object_initialize_child(OBJECT(machine), "soc", &s->soc, sizeof(s->soc), | 53 | /* |
24 | - board_soc_type(board_rev), &error_abort, NULL); | ||
25 | - | ||
26 | /* Allocate and map RAM */ | ||
27 | memory_region_allocate_system_memory(&s->ram, OBJECT(machine), "ram", | ||
28 | machine->ram_size); | ||
29 | @@ -XXX,XX +XXX,XX @@ static void raspi_init(MachineState *machine, uint32_t board_rev) | ||
30 | memory_region_add_subregion_overlap(get_system_memory(), 0, &s->ram, 0); | ||
31 | |||
32 | /* Setup the SOC */ | ||
33 | + object_initialize_child(OBJECT(machine), "soc", &s->soc, sizeof(s->soc), | ||
34 | + board_soc_type(board_rev), &error_abort, NULL); | ||
35 | object_property_add_const_link(OBJECT(&s->soc), "ram", OBJECT(&s->ram), | ||
36 | &error_abort); | ||
37 | object_property_set_int(OBJECT(&s->soc), board_rev, "board-rev", | ||
38 | -- | 54 | -- |
39 | 2.20.1 | 55 | 2.34.1 |
40 | 56 | ||
41 | 57 | diff view generated by jsdifflib |
1 | From: Heyi Guo <guoheyi@huawei.com> | 1 | From: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | The original code defines a named object for the resource template but | 3 | Cortex-A76 supports 40bits of address space. sbsa-ref's memory |
4 | then returns the resource template object itself; the resulted output | 4 | starts above this limit. |
5 | is like below: | ||
6 | 5 | ||
7 | Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings | 6 | Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org> |
8 | { | 7 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> |
9 | Name (RBUF, ResourceTemplate () | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
10 | { | 9 | Message-id: 20230126114416.2447685-1-marcin.juszkiewicz@linaro.org |
11 | WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, | ||
12 | 0x0000, // Granularity | ||
13 | 0x0000, // Range Minimum | ||
14 | 0x00FF, // Range Maximum | ||
15 | 0x0000, // Translation Offset | ||
16 | 0x0100, // Length | ||
17 | ,, ) | ||
18 | ...... | ||
19 | }) | ||
20 | Return (ResourceTemplate () | ||
21 | { | ||
22 | WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, | ||
23 | 0x0000, // Granularity | ||
24 | 0x0000, // Range Minimum | ||
25 | 0x00FF, // Range Maximum | ||
26 | 0x0000, // Translation Offset | ||
27 | 0x0100, // Length | ||
28 | ,, ) | ||
29 | ...... | ||
30 | }) | ||
31 | } | ||
32 | |||
33 | So the named object "RBUF" is actually useless. The more natural way | ||
34 | is to return RBUF instead, or simply drop RBUF definition. | ||
35 | |||
36 | Choose the latter one to simplify the code. | ||
37 | |||
38 | Signed-off-by: Heyi Guo <guoheyi@huawei.com> | ||
39 | Reviewed-by: Michael S. Tsirkin <mst@redhat.com> | ||
40 | Message-id: 20200204014325.16279-7-guoheyi@huawei.com | ||
41 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
42 | --- | 11 | --- |
43 | hw/arm/virt-acpi-build.c | 1 - | 12 | hw/arm/sbsa-ref.c | 1 - |
44 | 1 file changed, 1 deletion(-) | 13 | 1 file changed, 1 deletion(-) |
45 | 14 | ||
46 | diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c | 15 | diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c |
47 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
48 | --- a/hw/arm/virt-acpi-build.c | 17 | --- a/hw/arm/sbsa-ref.c |
49 | +++ b/hw/arm/virt-acpi-build.c | 18 | +++ b/hw/arm/sbsa-ref.c |
50 | @@ -XXX,XX +XXX,XX @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, | 19 | @@ -XXX,XX +XXX,XX @@ static const int sbsa_ref_irqmap[] = { |
51 | size_mmio_high)); | 20 | static const char * const valid_cpus[] = { |
52 | } | 21 | ARM_CPU_TYPE_NAME("cortex-a57"), |
53 | 22 | ARM_CPU_TYPE_NAME("cortex-a72"), | |
54 | - aml_append(method, aml_name_decl("RBUF", rbuf)); | 23 | - ARM_CPU_TYPE_NAME("cortex-a76"), |
55 | aml_append(method, aml_return(rbuf)); | 24 | ARM_CPU_TYPE_NAME("neoverse-n1"), |
56 | aml_append(dev, method); | 25 | ARM_CPU_TYPE_NAME("max"), |
57 | 26 | }; | |
58 | -- | 27 | -- |
59 | 2.20.1 | 28 | 2.34.1 |
60 | 29 | ||
61 | 30 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | The encodings 0,0,C7,C9,0 and 0,0,C7,C9,1 are AT SP1E1RP and AT |
---|---|---|---|
2 | S1E1WP, but our ARMCPRegInfo definitions for them incorrectly name | ||
3 | them AT S1E1R and AT S1E1W (which are entirely different | ||
4 | instructions). Fix the names. | ||
2 | 5 | ||
3 | We added a helper to extract the RAM size from the board | 6 | (This has no guest-visible effect as the names are for debug purposes |
4 | revision, and made board_rev a field of RaspiMachineClass. | 7 | only.) |
5 | The class_init() can now use the helper to extract from the | ||
6 | board revision the board-specific amount of RAM. | ||
7 | 8 | ||
8 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Message-id: 20200208165645.15657-11-f4bug@amsat.org | ||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | Tested-by: Fuad Tabba <tabba@google.com> | ||
12 | Message-id: 20230130182459.3309057-2-peter.maydell@linaro.org | ||
13 | Message-id: 20230127175507.2895013-2-peter.maydell@linaro.org | ||
12 | --- | 14 | --- |
13 | hw/arm/raspi.c | 4 ++-- | 15 | target/arm/helper.c | 4 ++-- |
14 | 1 file changed, 2 insertions(+), 2 deletions(-) | 16 | 1 file changed, 2 insertions(+), 2 deletions(-) |
15 | 17 | ||
16 | diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c | 18 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
17 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/hw/arm/raspi.c | 20 | --- a/target/arm/helper.c |
19 | +++ b/hw/arm/raspi.c | 21 | +++ b/target/arm/helper.c |
20 | @@ -XXX,XX +XXX,XX @@ static void raspi2_machine_class_init(ObjectClass *oc, void *data) | 22 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo vhe_reginfo[] = { |
21 | mc->max_cpus = BCM283X_NCPUS; | 23 | |
22 | mc->min_cpus = BCM283X_NCPUS; | 24 | #ifndef CONFIG_USER_ONLY |
23 | mc->default_cpus = BCM283X_NCPUS; | 25 | static const ARMCPRegInfo ats1e1_reginfo[] = { |
24 | - mc->default_ram_size = 1 * GiB; | 26 | - { .name = "AT_S1E1R", .state = ARM_CP_STATE_AA64, |
25 | + mc->default_ram_size = board_ram_size(board_rev); | 27 | + { .name = "AT_S1E1RP", .state = ARM_CP_STATE_AA64, |
26 | mc->ignore_memory_transaction_failures = true; | 28 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 9, .opc2 = 0, |
27 | }; | 29 | .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, |
28 | 30 | .writefn = ats_write64 }, | |
29 | @@ -XXX,XX +XXX,XX @@ static void raspi3_machine_class_init(ObjectClass *oc, void *data) | 31 | - { .name = "AT_S1E1W", .state = ARM_CP_STATE_AA64, |
30 | mc->max_cpus = BCM283X_NCPUS; | 32 | + { .name = "AT_S1E1WP", .state = ARM_CP_STATE_AA64, |
31 | mc->min_cpus = BCM283X_NCPUS; | 33 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 9, .opc2 = 1, |
32 | mc->default_cpus = BCM283X_NCPUS; | 34 | .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, |
33 | - mc->default_ram_size = 1 * GiB; | 35 | .writefn = ats_write64 }, |
34 | + mc->default_ram_size = board_ram_size(board_rev); | ||
35 | } | ||
36 | #endif | ||
37 | |||
38 | -- | 36 | -- |
39 | 2.20.1 | 37 | 2.34.1 |
40 | |||
41 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | The AArch32 ATS12NSO* address translation operations are supposed to |
---|---|---|---|
2 | trap to either EL2 or EL3 if they're executed at Secure EL1 (which | ||
3 | can only happen if EL3 is AArch64). We implement this, but we got | ||
4 | the syndrome value wrong: like other traps to EL2 or EL3 on an | ||
5 | AArch32 cpreg access, they should report the 0x3 syndrome, not the | ||
6 | 0x0 'uncategorized' syndrome. This is clear in the access pseudocode | ||
7 | for these instructions. | ||
2 | 8 | ||
3 | We need only override the current condition under which | 9 | Fix the syndrome value for these operations by correcting the |
4 | TBFLAG_A64.UNPRIV is set. | 10 | returned value from the ats_access() function. |
5 | 11 | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20200208125816.14954-20-richard.henderson@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
14 | Tested-by: Fuad Tabba <tabba@google.com> | ||
15 | Message-id: 20230130182459.3309057-3-peter.maydell@linaro.org | ||
16 | Message-id: 20230127175507.2895013-3-peter.maydell@linaro.org | ||
10 | --- | 17 | --- |
11 | target/arm/helper.c | 41 +++++++++++++++++++++-------------------- | 18 | target/arm/helper.c | 4 ++-- |
12 | 1 file changed, 21 insertions(+), 20 deletions(-) | 19 | 1 file changed, 2 insertions(+), 2 deletions(-) |
13 | 20 | ||
14 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 21 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
15 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/helper.c | 23 | --- a/target/arm/helper.c |
17 | +++ b/target/arm/helper.c | 24 | +++ b/target/arm/helper.c |
18 | @@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, | 25 | @@ -XXX,XX +XXX,XX @@ static CPAccessResult ats_access(CPUARMState *env, const ARMCPRegInfo *ri, |
19 | } | 26 | if (arm_current_el(env) == 1) { |
20 | 27 | if (arm_is_secure_below_el3(env)) { | |
21 | /* Compute the condition for using AccType_UNPRIV for LDTR et al. */ | 28 | if (env->cp15.scr_el3 & SCR_EEL2) { |
22 | - /* TODO: ARMv8.2-UAO */ | 29 | - return CP_ACCESS_TRAP_UNCATEGORIZED_EL2; |
23 | - switch (mmu_idx) { | 30 | + return CP_ACCESS_TRAP_EL2; |
24 | - case ARMMMUIdx_E10_1: | 31 | } |
25 | - case ARMMMUIdx_E10_1_PAN: | 32 | - return CP_ACCESS_TRAP_UNCATEGORIZED_EL3; |
26 | - case ARMMMUIdx_SE10_1: | 33 | + return CP_ACCESS_TRAP_EL3; |
27 | - case ARMMMUIdx_SE10_1_PAN: | 34 | } |
28 | - /* TODO: ARMv8.3-NV */ | 35 | return CP_ACCESS_TRAP_UNCATEGORIZED; |
29 | - flags = FIELD_DP32(flags, TBFLAG_A64, UNPRIV, 1); | ||
30 | - break; | ||
31 | - case ARMMMUIdx_E20_2: | ||
32 | - case ARMMMUIdx_E20_2_PAN: | ||
33 | - /* TODO: ARMv8.4-SecEL2 */ | ||
34 | - /* | ||
35 | - * Note that E20_2 is gated by HCR_EL2.E2H == 1, but E20_0 is | ||
36 | - * gated by HCR_EL2.<E2H,TGE> == '11', and so is LDTR. | ||
37 | - */ | ||
38 | - if (env->cp15.hcr_el2 & HCR_TGE) { | ||
39 | + if (!(env->pstate & PSTATE_UAO)) { | ||
40 | + switch (mmu_idx) { | ||
41 | + case ARMMMUIdx_E10_1: | ||
42 | + case ARMMMUIdx_E10_1_PAN: | ||
43 | + case ARMMMUIdx_SE10_1: | ||
44 | + case ARMMMUIdx_SE10_1_PAN: | ||
45 | + /* TODO: ARMv8.3-NV */ | ||
46 | flags = FIELD_DP32(flags, TBFLAG_A64, UNPRIV, 1); | ||
47 | + break; | ||
48 | + case ARMMMUIdx_E20_2: | ||
49 | + case ARMMMUIdx_E20_2_PAN: | ||
50 | + /* TODO: ARMv8.4-SecEL2 */ | ||
51 | + /* | ||
52 | + * Note that EL20_2 is gated by HCR_EL2.E2H == 1, but EL20_0 is | ||
53 | + * gated by HCR_EL2.<E2H,TGE> == '11', and so is LDTR. | ||
54 | + */ | ||
55 | + if (env->cp15.hcr_el2 & HCR_TGE) { | ||
56 | + flags = FIELD_DP32(flags, TBFLAG_A64, UNPRIV, 1); | ||
57 | + } | ||
58 | + break; | ||
59 | + default: | ||
60 | + break; | ||
61 | } | 36 | } |
62 | - break; | ||
63 | - default: | ||
64 | - break; | ||
65 | } | ||
66 | |||
67 | return rebuild_hflags_common(env, fp_el, mmu_idx, flags); | ||
68 | -- | 37 | -- |
69 | 2.20.1 | 38 | 2.34.1 |
70 | |||
71 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | We added the CPAccessResult values CP_ACCESS_TRAP_UNCATEGORIZED_EL2 |
---|---|---|---|
2 | and CP_ACCESS_TRAP_UNCATEGORIZED_EL3 purely in order to use them in | ||
3 | the ats_access() function, but doing so was incorrect (a bug fixed in | ||
4 | a previous commit). There aren't any cases where we want an access | ||
5 | function to be able to request a trap to EL2 or EL3 with a zero | ||
6 | syndrome value, so remove these enum values. | ||
2 | 7 | ||
3 | The only remaining use was in op_helper.c. Use PSTATE_SS | 8 | As well as cleaning up dead code, the motivation here is that |
4 | directly, and move the commentary so that it is more obvious | 9 | we'd like to implement fine-grained-trap handling in |
5 | what is going on. | 10 | helper_access_check_cp_reg(). Although the fine-grained traps |
11 | to EL2 are always lower priority than trap-to-same-EL and | ||
12 | higher priority than trap-to-EL3, they are in the middle of | ||
13 | various other kinds of trap-to-EL2. Knowing that a trap-to-EL2 | ||
14 | must always for us have the same syndrome (ie that an access | ||
15 | function will return CP_ACCESS_TRAP_EL2 and there is no other | ||
16 | kind of trap-to-EL2 enum value) means we don't have to try | ||
17 | to choose which of the two syndrome values to report if the | ||
18 | access would trap to EL2 both for the fine-grained-trap and | ||
19 | because the access function requires it. | ||
6 | 20 | ||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Message-id: 20200208125816.14954-10-richard.henderson@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 21 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
22 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
23 | Tested-by: Fuad Tabba <tabba@google.com> | ||
24 | Message-id: 20230130182459.3309057-4-peter.maydell@linaro.org | ||
25 | Message-id: 20230127175507.2895013-4-peter.maydell@linaro.org | ||
11 | --- | 26 | --- |
12 | target/arm/cpu.h | 6 ------ | 27 | target/arm/cpregs.h | 4 ++-- |
13 | target/arm/op_helper.c | 9 ++++++++- | 28 | target/arm/op_helper.c | 2 ++ |
14 | 2 files changed, 8 insertions(+), 7 deletions(-) | 29 | 2 files changed, 4 insertions(+), 2 deletions(-) |
15 | 30 | ||
16 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 31 | diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h |
17 | index XXXXXXX..XXXXXXX 100644 | 32 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/cpu.h | 33 | --- a/target/arm/cpregs.h |
19 | +++ b/target/arm/cpu.h | 34 | +++ b/target/arm/cpregs.h |
20 | @@ -XXX,XX +XXX,XX @@ void pmu_init(ARMCPU *cpu); | 35 | @@ -XXX,XX +XXX,XX @@ typedef enum CPAccessResult { |
21 | #define CPSR_IT_2_7 (0xfc00U) | 36 | * Access fails and results in an exception syndrome 0x0 ("uncategorized"). |
22 | #define CPSR_GE (0xfU << 16) | 37 | * Note that this is not a catch-all case -- the set of cases which may |
23 | #define CPSR_IL (1U << 20) | 38 | * result in this failure is specifically defined by the architecture. |
24 | -/* Note that the RESERVED bits include bit 21, which is PSTATE_SS in | 39 | + * This trap is always to the usual target EL, never directly to a |
25 | - * an AArch64 SPSR but RES0 in AArch32 SPSR and CPSR. In QEMU we use | 40 | + * specified target EL. |
26 | - * env->uncached_cpsr bit 21 to store PSTATE.SS when executing in AArch32, | 41 | */ |
27 | - * where it is live state but not accessible to the AArch32 code. | 42 | CP_ACCESS_TRAP_UNCATEGORIZED = (2 << 2), |
28 | - */ | 43 | - CP_ACCESS_TRAP_UNCATEGORIZED_EL2 = CP_ACCESS_TRAP_UNCATEGORIZED | 2, |
29 | -#define CPSR_RESERVED (0x7U << 21) | 44 | - CP_ACCESS_TRAP_UNCATEGORIZED_EL3 = CP_ACCESS_TRAP_UNCATEGORIZED | 3, |
30 | #define CPSR_J (1U << 24) | 45 | } CPAccessResult; |
31 | #define CPSR_IT_0_1 (3U << 25) | 46 | |
32 | #define CPSR_Q (1U << 27) | 47 | typedef struct ARMCPRegInfo ARMCPRegInfo; |
33 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c | 48 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c |
34 | index XXXXXXX..XXXXXXX 100644 | 49 | index XXXXXXX..XXXXXXX 100644 |
35 | --- a/target/arm/op_helper.c | 50 | --- a/target/arm/op_helper.c |
36 | +++ b/target/arm/op_helper.c | 51 | +++ b/target/arm/op_helper.c |
37 | @@ -XXX,XX +XXX,XX @@ void HELPER(exception_bkpt_insn)(CPUARMState *env, uint32_t syndrome) | 52 | @@ -XXX,XX +XXX,XX @@ const void *HELPER(access_check_cp_reg)(CPUARMState *env, uint32_t key, |
38 | 53 | case CP_ACCESS_TRAP: | |
39 | uint32_t HELPER(cpsr_read)(CPUARMState *env) | 54 | break; |
40 | { | 55 | case CP_ACCESS_TRAP_UNCATEGORIZED: |
41 | - return cpsr_read(env) & ~(CPSR_EXEC | CPSR_RESERVED); | 56 | + /* Only CP_ACCESS_TRAP traps are direct to a specified EL */ |
42 | + /* | 57 | + assert((res & CP_ACCESS_EL_MASK) == 0); |
43 | + * We store the ARMv8 PSTATE.SS bit in env->uncached_cpsr. | 58 | if (cpu_isar_feature(aa64_ids, cpu) && isread && |
44 | + * This is convenient for populating SPSR_ELx, but must be | 59 | arm_cpreg_in_idspace(ri)) { |
45 | + * hidden from aarch32 mode, where it is not visible. | 60 | /* |
46 | + * | ||
47 | + * TODO: ARMv8.4-DIT -- need to move SS somewhere else. | ||
48 | + */ | ||
49 | + return cpsr_read(env) & ~(CPSR_EXEC | PSTATE_SS); | ||
50 | } | ||
51 | |||
52 | void HELPER(cpsr_write)(CPUARMState *env, uint32_t val, uint32_t mask) | ||
53 | -- | 61 | -- |
54 | 2.20.1 | 62 | 2.34.1 |
55 | |||
56 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | Rearrange the code in do_coproc_insn() so that we calculate the |
---|---|---|---|
2 | syndrome value for a potential trap early; we're about to add a | ||
3 | second check that wants this value earlier than where it is currently | ||
4 | determined. | ||
2 | 5 | ||
3 | Split this helper out of msr_mask in translate.c. At the same time, | 6 | (Specifically, a trap to EL2 because of HSTR_EL2 should take |
4 | transform the negative reductive logic to positive accumulative logic. | 7 | priority over an UNDEF to EL1, even when the UNDEF is because |
5 | It will be usable along the exception paths. | 8 | the register does not exist at all or because its ri->access |
9 | bits non-configurably fail the access. So the check we put in | ||
10 | for HSTR_EL2 trapping at EL1 (which needs the syndrome) is | ||
11 | going to have to be done before the check "is the ARMCPRegInfo | ||
12 | pointer NULL".) | ||
6 | 13 | ||
7 | While touching msr_mask, fix up formatting. | 14 | This commit is just code motion; the change to HSTR_EL2 |
15 | handling that will use the 'syndrome' variable is in a | ||
16 | subsequent commit. | ||
8 | 17 | ||
9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Message-id: 20200208125816.14954-6-richard.henderson@linaro.org | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
19 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
20 | Tested-by: Fuad Tabba <tabba@google.com> | ||
21 | Message-id: 20230130182459.3309057-5-peter.maydell@linaro.org | ||
22 | Message-id: 20230127175507.2895013-5-peter.maydell@linaro.org | ||
13 | --- | 23 | --- |
14 | target/arm/internals.h | 21 +++++++++++++++++++++ | 24 | target/arm/translate.c | 83 +++++++++++++++++++++--------------------- |
15 | target/arm/translate.c | 40 +++++++++++++++++----------------------- | 25 | 1 file changed, 41 insertions(+), 42 deletions(-) |
16 | 2 files changed, 38 insertions(+), 23 deletions(-) | ||
17 | 26 | ||
18 | diff --git a/target/arm/internals.h b/target/arm/internals.h | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/target/arm/internals.h | ||
21 | +++ b/target/arm/internals.h | ||
22 | @@ -XXX,XX +XXX,XX @@ static inline bool arm_mmu_idx_is_stage1_of_2(ARMMMUIdx mmu_idx) | ||
23 | } | ||
24 | } | ||
25 | |||
26 | +static inline uint32_t aarch32_cpsr_valid_mask(uint64_t features, | ||
27 | + const ARMISARegisters *id) | ||
28 | +{ | ||
29 | + uint32_t valid = CPSR_M | CPSR_AIF | CPSR_IL | CPSR_NZCV | CPSR_J; | ||
30 | + | ||
31 | + if ((features >> ARM_FEATURE_V4T) & 1) { | ||
32 | + valid |= CPSR_T; | ||
33 | + } | ||
34 | + if ((features >> ARM_FEATURE_V5) & 1) { | ||
35 | + valid |= CPSR_Q; /* V5TE in reality*/ | ||
36 | + } | ||
37 | + if ((features >> ARM_FEATURE_V6) & 1) { | ||
38 | + valid |= CPSR_E | CPSR_GE; | ||
39 | + } | ||
40 | + if ((features >> ARM_FEATURE_THUMB2) & 1) { | ||
41 | + valid |= CPSR_IT; | ||
42 | + } | ||
43 | + | ||
44 | + return valid; | ||
45 | +} | ||
46 | + | ||
47 | /* | ||
48 | * Parameters of a given virtual address, as extracted from the | ||
49 | * translation control register (TCR) for a given regime. | ||
50 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 27 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
51 | index XXXXXXX..XXXXXXX 100644 | 28 | index XXXXXXX..XXXXXXX 100644 |
52 | --- a/target/arm/translate.c | 29 | --- a/target/arm/translate.c |
53 | +++ b/target/arm/translate.c | 30 | +++ b/target/arm/translate.c |
54 | @@ -XXX,XX +XXX,XX @@ static inline void gen_mulxy(TCGv_i32 t0, TCGv_i32 t1, int x, int y) | 31 | @@ -XXX,XX +XXX,XX @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, |
55 | /* Return the mask of PSR bits set by a MSR instruction. */ | 32 | const ARMCPRegInfo *ri = get_arm_cp_reginfo(s->cp_regs, key); |
56 | static uint32_t msr_mask(DisasContext *s, int flags, int spsr) | 33 | TCGv_ptr tcg_ri = NULL; |
57 | { | 34 | bool need_exit_tb; |
58 | - uint32_t mask; | 35 | + uint32_t syndrome; |
59 | + uint32_t mask = 0; | 36 | + |
60 | 37 | + /* | |
61 | - mask = 0; | 38 | + * Note that since we are an implementation which takes an |
62 | - if (flags & (1 << 0)) | 39 | + * exception on a trapped conditional instruction only if the |
63 | + if (flags & (1 << 0)) { | 40 | + * instruction passes its condition code check, we can take |
64 | mask |= 0xff; | 41 | + * advantage of the clause in the ARM ARM that allows us to set |
65 | - if (flags & (1 << 1)) | 42 | + * the COND field in the instruction to 0xE in all cases. |
43 | + * We could fish the actual condition out of the insn (ARM) | ||
44 | + * or the condexec bits (Thumb) but it isn't necessary. | ||
45 | + */ | ||
46 | + switch (cpnum) { | ||
47 | + case 14: | ||
48 | + if (is64) { | ||
49 | + syndrome = syn_cp14_rrt_trap(1, 0xe, opc1, crm, rt, rt2, | ||
50 | + isread, false); | ||
51 | + } else { | ||
52 | + syndrome = syn_cp14_rt_trap(1, 0xe, opc1, opc2, crn, crm, | ||
53 | + rt, isread, false); | ||
54 | + } | ||
55 | + break; | ||
56 | + case 15: | ||
57 | + if (is64) { | ||
58 | + syndrome = syn_cp15_rrt_trap(1, 0xe, opc1, crm, rt, rt2, | ||
59 | + isread, false); | ||
60 | + } else { | ||
61 | + syndrome = syn_cp15_rt_trap(1, 0xe, opc1, opc2, crn, crm, | ||
62 | + rt, isread, false); | ||
63 | + } | ||
64 | + break; | ||
65 | + default: | ||
66 | + /* | ||
67 | + * ARMv8 defines that only coprocessors 14 and 15 exist, | ||
68 | + * so this can only happen if this is an ARMv7 or earlier CPU, | ||
69 | + * in which case the syndrome information won't actually be | ||
70 | + * guest visible. | ||
71 | + */ | ||
72 | + assert(!arm_dc_feature(s, ARM_FEATURE_V8)); | ||
73 | + syndrome = syn_uncategorized(); | ||
74 | + break; | ||
66 | + } | 75 | + } |
67 | + if (flags & (1 << 1)) { | 76 | |
68 | mask |= 0xff00; | 77 | if (!ri) { |
69 | - if (flags & (1 << 2)) | 78 | /* |
70 | + } | 79 | @@ -XXX,XX +XXX,XX @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, |
71 | + if (flags & (1 << 2)) { | 80 | * Note that on XScale all cp0..c13 registers do an access check |
72 | mask |= 0xff0000; | 81 | * call in order to handle c15_cpar. |
73 | - if (flags & (1 << 3)) | 82 | */ |
74 | + } | 83 | - uint32_t syndrome; |
75 | + if (flags & (1 << 3)) { | 84 | - |
76 | mask |= 0xff000000; | 85 | - /* |
77 | + } | 86 | - * Note that since we are an implementation which takes an |
78 | 87 | - * exception on a trapped conditional instruction only if the | |
79 | - /* Mask out undefined bits. */ | 88 | - * instruction passes its condition code check, we can take |
80 | - mask &= ~CPSR_RESERVED; | 89 | - * advantage of the clause in the ARM ARM that allows us to set |
81 | - if (!arm_dc_feature(s, ARM_FEATURE_V4T)) { | 90 | - * the COND field in the instruction to 0xE in all cases. |
82 | - mask &= ~CPSR_T; | 91 | - * We could fish the actual condition out of the insn (ARM) |
83 | - } | 92 | - * or the condexec bits (Thumb) but it isn't necessary. |
84 | - if (!arm_dc_feature(s, ARM_FEATURE_V5)) { | 93 | - */ |
85 | - mask &= ~CPSR_Q; /* V5TE in reality*/ | 94 | - switch (cpnum) { |
86 | - } | 95 | - case 14: |
87 | - if (!arm_dc_feature(s, ARM_FEATURE_V6)) { | 96 | - if (is64) { |
88 | - mask &= ~(CPSR_E | CPSR_GE); | 97 | - syndrome = syn_cp14_rrt_trap(1, 0xe, opc1, crm, rt, rt2, |
89 | - } | 98 | - isread, false); |
90 | - if (!arm_dc_feature(s, ARM_FEATURE_THUMB2)) { | 99 | - } else { |
91 | - mask &= ~CPSR_IT; | 100 | - syndrome = syn_cp14_rt_trap(1, 0xe, opc1, opc2, crn, crm, |
92 | - } | 101 | - rt, isread, false); |
93 | - /* Mask out execution state and reserved bits. */ | 102 | - } |
94 | + /* Mask out undefined and reserved bits. */ | 103 | - break; |
95 | + mask &= aarch32_cpsr_valid_mask(s->features, s->isar); | 104 | - case 15: |
96 | + | 105 | - if (is64) { |
97 | + /* Mask out execution state. */ | 106 | - syndrome = syn_cp15_rrt_trap(1, 0xe, opc1, crm, rt, rt2, |
98 | if (!spsr) { | 107 | - isread, false); |
99 | - mask &= ~(CPSR_EXEC | CPSR_RESERVED); | 108 | - } else { |
100 | + mask &= ~CPSR_EXEC; | 109 | - syndrome = syn_cp15_rt_trap(1, 0xe, opc1, opc2, crn, crm, |
101 | } | 110 | - rt, isread, false); |
102 | + | 111 | - } |
103 | /* Mask out privileged bits. */ | 112 | - break; |
104 | - if (IS_USER(s)) | 113 | - default: |
105 | + if (IS_USER(s)) { | 114 | - /* |
106 | mask &= CPSR_USER; | 115 | - * ARMv8 defines that only coprocessors 14 and 15 exist, |
107 | + } | 116 | - * so this can only happen if this is an ARMv7 or earlier CPU, |
108 | return mask; | 117 | - * in which case the syndrome information won't actually be |
109 | } | 118 | - * guest visible. |
110 | 119 | - */ | |
120 | - assert(!arm_dc_feature(s, ARM_FEATURE_V8)); | ||
121 | - syndrome = syn_uncategorized(); | ||
122 | - break; | ||
123 | - } | ||
124 | - | ||
125 | gen_set_condexec(s); | ||
126 | gen_update_pc(s, 0); | ||
127 | tcg_ri = tcg_temp_new_ptr(); | ||
111 | -- | 128 | -- |
112 | 2.20.1 | 129 | 2.34.1 |
113 | |||
114 | diff view generated by jsdifflib |
1 | From: Guenter Roeck <linux@roeck-us.net> | 1 | The HSTR_EL2 register has a collection of trap bits which allow |
---|---|---|---|
2 | trapping to EL2 for AArch32 EL0 or EL1 accesses to coprocessor | ||
3 | registers. The specification of these bits is that when the bit is | ||
4 | set we should trap | ||
5 | * EL1 accesses | ||
6 | * EL0 accesses, if the access is not UNDEFINED when the | ||
7 | trap bit is 0 | ||
2 | 8 | ||
3 | Initialize EHCI controllers on AST2400 and AST2500 using the existing | 9 | In other words, all UNDEF traps from EL0 to EL1 take precedence over |
4 | TYPE_PLATFORM_EHCI. After this change, booting ast2500-evb into Linux | 10 | the HSTR_EL2 trap to EL2. (Since this is all AArch32, the only kind |
5 | successfully instantiates a USB interface. | 11 | of trap-to-EL1 is the UNDEF.) |
6 | 12 | ||
7 | ehci-platform 1e6a3000.usb: EHCI Host Controller | 13 | Our implementation doesn't quite get this right -- we check for traps |
8 | ehci-platform 1e6a3000.usb: new USB bus registered, assigned bus number 1 | 14 | in the order: |
9 | ehci-platform 1e6a3000.usb: irq 21, io mem 0x1e6a3000 | 15 | * no such register |
10 | ehci-platform 1e6a3000.usb: USB 2.0 started, EHCI 1.00 | 16 | * ARMCPRegInfo::access bits |
11 | usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.05 | 17 | * HSTR_EL2 trap bits |
12 | usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1 | 18 | * ARMCPRegInfo::accessfn |
13 | usb usb1: Product: EHCI Host Controller | ||
14 | 19 | ||
15 | Signed-off-by: Guenter Roeck <linux@roeck-us.net> | 20 | So UNDEFs that happen because of the access bits or because the |
16 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | 21 | register doesn't exist at all correctly take priority over the |
17 | Reviewed-by: Joel Stanley <joel@jms.id.au> | 22 | HSTR_EL2 trap, but where a register can UNDEF at EL0 because of the |
18 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 23 | accessfn we are incorrectly always taking the HSTR_EL2 trap. There |
19 | Message-id: 20200206183437.3979-1-linux@roeck-us.net | 24 | aren't many of these, but one example is the PMCR; if you look at the |
25 | access pseudocode for this register you can see that UNDEFs taken | ||
26 | because of the value of PMUSERENR.EN are checked before the HSTR_EL2 | ||
27 | bit. | ||
28 | |||
29 | Rearrange helper_access_check_cp_reg() so that we always call the | ||
30 | accessfn, and use its return value if it indicates that the access | ||
31 | traps to EL0 rather than continuing to do the HSTR_EL2 check. | ||
32 | |||
20 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 33 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
34 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
35 | Tested-by: Fuad Tabba <tabba@google.com> | ||
36 | Message-id: 20230130182459.3309057-6-peter.maydell@linaro.org | ||
37 | Message-id: 20230127175507.2895013-6-peter.maydell@linaro.org | ||
21 | --- | 38 | --- |
22 | include/hw/arm/aspeed_soc.h | 6 ++++++ | 39 | target/arm/op_helper.c | 21 ++++++++++++++++----- |
23 | hw/arm/aspeed_soc.c | 25 +++++++++++++++++++++++++ | 40 | 1 file changed, 16 insertions(+), 5 deletions(-) |
24 | 2 files changed, 31 insertions(+) | ||
25 | 41 | ||
26 | diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h | 42 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c |
27 | index XXXXXXX..XXXXXXX 100644 | 43 | index XXXXXXX..XXXXXXX 100644 |
28 | --- a/include/hw/arm/aspeed_soc.h | 44 | --- a/target/arm/op_helper.c |
29 | +++ b/include/hw/arm/aspeed_soc.h | 45 | +++ b/target/arm/op_helper.c |
30 | @@ -XXX,XX +XXX,XX @@ | 46 | @@ -XXX,XX +XXX,XX @@ const void *HELPER(access_check_cp_reg)(CPUARMState *env, uint32_t key, |
31 | #include "target/arm/cpu.h" | 47 | goto fail; |
32 | #include "hw/gpio/aspeed_gpio.h" | ||
33 | #include "hw/sd/aspeed_sdhci.h" | ||
34 | +#include "hw/usb/hcd-ehci.h" | ||
35 | |||
36 | #define ASPEED_SPIS_NUM 2 | ||
37 | +#define ASPEED_EHCIS_NUM 2 | ||
38 | #define ASPEED_WDTS_NUM 4 | ||
39 | #define ASPEED_CPUS_NUM 2 | ||
40 | #define ASPEED_MACS_NUM 4 | ||
41 | @@ -XXX,XX +XXX,XX @@ typedef struct AspeedSoCState { | ||
42 | AspeedXDMAState xdma; | ||
43 | AspeedSMCState fmc; | ||
44 | AspeedSMCState spi[ASPEED_SPIS_NUM]; | ||
45 | + EHCISysBusState ehci[ASPEED_EHCIS_NUM]; | ||
46 | AspeedSDMCState sdmc; | ||
47 | AspeedWDTState wdt[ASPEED_WDTS_NUM]; | ||
48 | FTGMAC100State ftgmac100[ASPEED_MACS_NUM]; | ||
49 | @@ -XXX,XX +XXX,XX @@ typedef struct AspeedSoCClass { | ||
50 | uint32_t silicon_rev; | ||
51 | uint64_t sram_size; | ||
52 | int spis_num; | ||
53 | + int ehcis_num; | ||
54 | int wdts_num; | ||
55 | int macs_num; | ||
56 | const int *irqmap; | ||
57 | @@ -XXX,XX +XXX,XX @@ enum { | ||
58 | ASPEED_FMC, | ||
59 | ASPEED_SPI1, | ||
60 | ASPEED_SPI2, | ||
61 | + ASPEED_EHCI1, | ||
62 | + ASPEED_EHCI2, | ||
63 | ASPEED_VIC, | ||
64 | ASPEED_SDMC, | ||
65 | ASPEED_SCU, | ||
66 | diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c | ||
67 | index XXXXXXX..XXXXXXX 100644 | ||
68 | --- a/hw/arm/aspeed_soc.c | ||
69 | +++ b/hw/arm/aspeed_soc.c | ||
70 | @@ -XXX,XX +XXX,XX @@ static const hwaddr aspeed_soc_ast2400_memmap[] = { | ||
71 | [ASPEED_IOMEM] = 0x1E600000, | ||
72 | [ASPEED_FMC] = 0x1E620000, | ||
73 | [ASPEED_SPI1] = 0x1E630000, | ||
74 | + [ASPEED_EHCI1] = 0x1E6A1000, | ||
75 | [ASPEED_VIC] = 0x1E6C0000, | ||
76 | [ASPEED_SDMC] = 0x1E6E0000, | ||
77 | [ASPEED_SCU] = 0x1E6E2000, | ||
78 | @@ -XXX,XX +XXX,XX @@ static const hwaddr aspeed_soc_ast2500_memmap[] = { | ||
79 | [ASPEED_FMC] = 0x1E620000, | ||
80 | [ASPEED_SPI1] = 0x1E630000, | ||
81 | [ASPEED_SPI2] = 0x1E631000, | ||
82 | + [ASPEED_EHCI1] = 0x1E6A1000, | ||
83 | + [ASPEED_EHCI2] = 0x1E6A3000, | ||
84 | [ASPEED_VIC] = 0x1E6C0000, | ||
85 | [ASPEED_SDMC] = 0x1E6E0000, | ||
86 | [ASPEED_SCU] = 0x1E6E2000, | ||
87 | @@ -XXX,XX +XXX,XX @@ static const int aspeed_soc_ast2400_irqmap[] = { | ||
88 | [ASPEED_UART5] = 10, | ||
89 | [ASPEED_VUART] = 8, | ||
90 | [ASPEED_FMC] = 19, | ||
91 | + [ASPEED_EHCI1] = 5, | ||
92 | + [ASPEED_EHCI2] = 13, | ||
93 | [ASPEED_SDMC] = 0, | ||
94 | [ASPEED_SCU] = 21, | ||
95 | [ASPEED_ADC] = 31, | ||
96 | @@ -XXX,XX +XXX,XX @@ static void aspeed_soc_init(Object *obj) | ||
97 | sizeof(s->spi[i]), typename); | ||
98 | } | 48 | } |
99 | 49 | ||
100 | + for (i = 0; i < sc->ehcis_num; i++) { | 50 | + if (ri->accessfn) { |
101 | + sysbus_init_child_obj(obj, "ehci[*]", OBJECT(&s->ehci[i]), | 51 | + res = ri->accessfn(env, ri, isread); |
102 | + sizeof(s->ehci[i]), TYPE_PLATFORM_EHCI); | ||
103 | + } | 52 | + } |
104 | + | 53 | + |
105 | snprintf(typename, sizeof(typename), "aspeed.sdmc-%s", socname); | 54 | /* |
106 | sysbus_init_child_obj(obj, "sdmc", OBJECT(&s->sdmc), sizeof(s->sdmc), | 55 | - * Check for an EL2 trap due to HSTR_EL2. We expect EL0 accesses |
107 | typename); | 56 | - * to sysregs non accessible at EL0 to have UNDEF-ed already. |
108 | @@ -XXX,XX +XXX,XX @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp) | 57 | + * If the access function indicates a trap from EL0 to EL1 then |
109 | s->spi[i].ctrl->flash_window_base); | 58 | + * that always takes priority over the HSTR_EL2 trap. (If it indicates |
110 | } | 59 | + * a trap to EL3, then the HSTR_EL2 trap takes priority; if it indicates |
111 | 60 | + * a trap to EL2, then the syndrome is the same either way so we don't | |
112 | + /* EHCI */ | 61 | + * care whether technically the architecture says that HSTR_EL2 trap or |
113 | + for (i = 0; i < sc->ehcis_num; i++) { | 62 | + * the other trap takes priority. So we take the "check HSTR_EL2" path |
114 | + object_property_set_bool(OBJECT(&s->ehci[i]), true, "realized", &err); | 63 | + * for all of those cases.) |
115 | + if (err) { | 64 | */ |
116 | + error_propagate(errp, err); | 65 | + if (res != CP_ACCESS_OK && ((res & CP_ACCESS_EL_MASK) == 0) && |
117 | + return; | 66 | + arm_current_el(env) == 0) { |
118 | + } | 67 | + goto fail; |
119 | + sysbus_mmio_map(SYS_BUS_DEVICE(&s->ehci[i]), 0, | ||
120 | + sc->memmap[ASPEED_EHCI1 + i]); | ||
121 | + sysbus_connect_irq(SYS_BUS_DEVICE(&s->ehci[i]), 0, | ||
122 | + aspeed_soc_get_irq(s, ASPEED_EHCI1 + i)); | ||
123 | + } | 68 | + } |
124 | + | 69 | + |
125 | /* SDMC - SDRAM Memory Controller */ | 70 | if (!is_a64(env) && arm_current_el(env) < 2 && ri->cp == 15 && |
126 | object_property_set_bool(OBJECT(&s->sdmc), true, "realized", &err); | 71 | (arm_hcr_el2_eff(env) & (HCR_E2H | HCR_TGE)) != (HCR_E2H | HCR_TGE)) { |
127 | if (err) { | 72 | uint32_t mask = 1 << ri->crn; |
128 | @@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2400_class_init(ObjectClass *oc, void *data) | 73 | @@ -XXX,XX +XXX,XX @@ const void *HELPER(access_check_cp_reg)(CPUARMState *env, uint32_t key, |
129 | sc->silicon_rev = AST2400_A1_SILICON_REV; | 74 | } |
130 | sc->sram_size = 0x8000; | 75 | } |
131 | sc->spis_num = 1; | 76 | |
132 | + sc->ehcis_num = 1; | 77 | - if (ri->accessfn) { |
133 | sc->wdts_num = 2; | 78 | - res = ri->accessfn(env, ri, isread); |
134 | sc->macs_num = 2; | 79 | - } |
135 | sc->irqmap = aspeed_soc_ast2400_irqmap; | 80 | if (likely(res == CP_ACCESS_OK)) { |
136 | @@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2500_class_init(ObjectClass *oc, void *data) | 81 | return ri; |
137 | sc->silicon_rev = AST2500_A1_SILICON_REV; | 82 | } |
138 | sc->sram_size = 0x9000; | ||
139 | sc->spis_num = 2; | ||
140 | + sc->ehcis_num = 2; | ||
141 | sc->wdts_num = 3; | ||
142 | sc->macs_num = 2; | ||
143 | sc->irqmap = aspeed_soc_ast2500_irqmap; | ||
144 | -- | 83 | -- |
145 | 2.20.1 | 84 | 2.34.1 |
146 | |||
147 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | The semantics of HSTR_EL2 require that it traps cpreg accesses |
---|---|---|---|
2 | to EL2 for: | ||
3 | * EL1 accesses | ||
4 | * EL0 accesses, if the access is not UNDEFINED when the | ||
5 | trap bit is 0 | ||
2 | 6 | ||
3 | CPSR_ERET_MASK was a useless renaming of CPSR_RESERVED. | 7 | (You can see this in the I_ZFGJP priority ordering, where HSTR_EL2 |
4 | The function also takes into account bits that the cpu | 8 | traps from EL1 to EL2 are priority 12, UNDEFs are priority 13, and |
5 | does not support. | 9 | HSTR_EL2 traps from EL0 are priority 15.) |
6 | 10 | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 11 | However, we don't get this right for EL1 accesses which UNDEF because |
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 12 | the register doesn't exist at all or because its ri->access bits |
9 | Message-id: 20200208125816.14954-8-richard.henderson@linaro.org | 13 | non-configurably forbid the access. At EL1, check for the HSTR_EL2 |
14 | trap early, before either of these UNDEF reasons. | ||
15 | |||
16 | We have to retain the HSTR_EL2 check in access_check_cp_reg(), | ||
17 | because at EL0 any kind of UNDEF-to-EL1 (including "no such | ||
18 | register", "bad ri->access" and "ri->accessfn returns 'trap to EL1'") | ||
19 | takes precedence over the trap to EL2. But we only need to do that | ||
20 | check for EL0 now. | ||
21 | |||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 22 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
23 | Tested-by: Fuad Tabba <tabba@google.com> | ||
24 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
25 | Message-id: 20230130182459.3309057-7-peter.maydell@linaro.org | ||
26 | Message-id: 20230127175507.2895013-7-peter.maydell@linaro.org | ||
11 | --- | 27 | --- |
12 | target/arm/cpu.h | 2 -- | 28 | target/arm/op_helper.c | 6 +++++- |
13 | target/arm/op_helper.c | 5 ++++- | 29 | target/arm/translate.c | 28 +++++++++++++++++++++++++++- |
14 | 2 files changed, 4 insertions(+), 3 deletions(-) | 30 | 2 files changed, 32 insertions(+), 2 deletions(-) |
15 | 31 | ||
16 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/target/arm/cpu.h | ||
19 | +++ b/target/arm/cpu.h | ||
20 | @@ -XXX,XX +XXX,XX @@ void pmu_init(ARMCPU *cpu); | ||
21 | #define CPSR_USER (CPSR_NZCV | CPSR_Q | CPSR_GE) | ||
22 | /* Execution state bits. MRS read as zero, MSR writes ignored. */ | ||
23 | #define CPSR_EXEC (CPSR_T | CPSR_IT | CPSR_J | CPSR_IL) | ||
24 | -/* Mask of bits which may be set by exception return copying them from SPSR */ | ||
25 | -#define CPSR_ERET_MASK (~CPSR_RESERVED) | ||
26 | |||
27 | /* Bit definitions for M profile XPSR. Most are the same as CPSR. */ | ||
28 | #define XPSR_EXCP 0x1ffU | ||
29 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c | 32 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c |
30 | index XXXXXXX..XXXXXXX 100644 | 33 | index XXXXXXX..XXXXXXX 100644 |
31 | --- a/target/arm/op_helper.c | 34 | --- a/target/arm/op_helper.c |
32 | +++ b/target/arm/op_helper.c | 35 | +++ b/target/arm/op_helper.c |
33 | @@ -XXX,XX +XXX,XX @@ void HELPER(cpsr_write)(CPUARMState *env, uint32_t val, uint32_t mask) | 36 | @@ -XXX,XX +XXX,XX @@ const void *HELPER(access_check_cp_reg)(CPUARMState *env, uint32_t key, |
34 | /* Write the CPSR for a 32-bit exception return */ | 37 | goto fail; |
35 | void HELPER(cpsr_write_eret)(CPUARMState *env, uint32_t val) | 38 | } |
36 | { | 39 | |
37 | + uint32_t mask; | 40 | - if (!is_a64(env) && arm_current_el(env) < 2 && ri->cp == 15 && |
41 | + /* | ||
42 | + * HSTR_EL2 traps from EL1 are checked earlier, in generated code; | ||
43 | + * we only need to check here for traps from EL0. | ||
44 | + */ | ||
45 | + if (!is_a64(env) && arm_current_el(env) == 0 && ri->cp == 15 && | ||
46 | (arm_hcr_el2_eff(env) & (HCR_E2H | HCR_TGE)) != (HCR_E2H | HCR_TGE)) { | ||
47 | uint32_t mask = 1 << ri->crn; | ||
48 | |||
49 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
50 | index XXXXXXX..XXXXXXX 100644 | ||
51 | --- a/target/arm/translate.c | ||
52 | +++ b/target/arm/translate.c | ||
53 | @@ -XXX,XX +XXX,XX @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, | ||
54 | break; | ||
55 | } | ||
56 | |||
57 | + if (s->hstr_active && cpnum == 15 && s->current_el == 1) { | ||
58 | + /* | ||
59 | + * At EL1, check for a HSTR_EL2 trap, which must take precedence | ||
60 | + * over the UNDEF for "no such register" or the UNDEF for "access | ||
61 | + * permissions forbid this EL1 access". HSTR_EL2 traps from EL0 | ||
62 | + * only happen if the cpreg doesn't UNDEF at EL0, so we do those in | ||
63 | + * access_check_cp_reg(), after the checks for whether the access | ||
64 | + * configurably trapped to EL1. | ||
65 | + */ | ||
66 | + uint32_t maskbit = is64 ? crm : crn; | ||
38 | + | 67 | + |
39 | qemu_mutex_lock_iothread(); | 68 | + if (maskbit != 4 && maskbit != 14) { |
40 | arm_call_pre_el_change_hook(env_archcpu(env)); | 69 | + /* T4 and T14 are RES0 so never cause traps */ |
41 | qemu_mutex_unlock_iothread(); | 70 | + TCGv_i32 t; |
42 | 71 | + DisasLabel over = gen_disas_label(s); | |
43 | - cpsr_write(env, val, CPSR_ERET_MASK, CPSRWriteExceptionReturn); | 72 | + |
44 | + mask = aarch32_cpsr_valid_mask(env->features, &env_archcpu(env)->isar); | 73 | + t = load_cpu_offset(offsetoflow32(CPUARMState, cp15.hstr_el2)); |
45 | + cpsr_write(env, val, mask, CPSRWriteExceptionReturn); | 74 | + tcg_gen_andi_i32(t, t, 1u << maskbit); |
46 | 75 | + tcg_gen_brcondi_i32(TCG_COND_EQ, t, 0, over.label); | |
47 | /* Generated code has already stored the new PC value, but | 76 | + tcg_temp_free_i32(t); |
48 | * without masking out its low bits, because which bits need | 77 | + |
78 | + gen_exception_insn(s, 0, EXCP_UDEF, syndrome); | ||
79 | + set_disas_label(s, over); | ||
80 | + } | ||
81 | + } | ||
82 | + | ||
83 | if (!ri) { | ||
84 | /* | ||
85 | * Unknown register; this might be a guest error or a QEMU | ||
86 | @@ -XXX,XX +XXX,XX @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, | ||
87 | return; | ||
88 | } | ||
89 | |||
90 | - if (s->hstr_active || ri->accessfn || | ||
91 | + if ((s->hstr_active && s->current_el == 0) || ri->accessfn || | ||
92 | (arm_dc_feature(s, ARM_FEATURE_XSCALE) && cpnum < 14)) { | ||
93 | /* | ||
94 | * Emit code to perform further access permissions checks at | ||
49 | -- | 95 | -- |
50 | 2.20.1 | 96 | 2.34.1 |
51 | |||
52 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | The HSTR_EL2 register is not supposed to have an effect unless EL2 is |
---|---|---|---|
2 | enabled in the current security state. We weren't checking for this, | ||
3 | which meant that if the guest set up the HSTR_EL2 register we would | ||
4 | incorrectly trap even for accesses from Secure EL0 and EL1. | ||
2 | 5 | ||
3 | For static const regdefs, file scope is preferred. | 6 | Add the missing checks. (Other places where we look at HSTR_EL2 |
7 | for the not-in-v8A bits TTEE and TJDBX are already checking that | ||
8 | we are in NS EL0 or EL1, so there we alredy know EL2 is enabled.) | ||
4 | 9 | ||
5 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20200208125816.14954-5-richard.henderson@linaro.org | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
12 | Tested-by: Fuad Tabba <tabba@google.com> | ||
13 | Message-id: 20230130182459.3309057-8-peter.maydell@linaro.org | ||
14 | Message-id: 20230127175507.2895013-8-peter.maydell@linaro.org | ||
9 | --- | 15 | --- |
10 | target/arm/helper.c | 57 +++++++++++++++++++++++---------------------- | 16 | target/arm/helper.c | 2 +- |
11 | 1 file changed, 29 insertions(+), 28 deletions(-) | 17 | target/arm/op_helper.c | 1 + |
18 | 2 files changed, 2 insertions(+), 1 deletion(-) | ||
12 | 19 | ||
13 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 20 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
14 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/helper.c | 22 | --- a/target/arm/helper.c |
16 | +++ b/target/arm/helper.c | 23 | +++ b/target/arm/helper.c |
17 | @@ -XXX,XX +XXX,XX @@ static CPAccessResult access_lor_other(CPUARMState *env, | 24 | @@ -XXX,XX +XXX,XX @@ static CPUARMTBFlags rebuild_hflags_a32(CPUARMState *env, int fp_el, |
18 | return access_lor_ns(env); | 25 | DP_TBFLAG_A32(flags, VFPEN, 1); |
19 | } | ||
20 | |||
21 | +/* | ||
22 | + * A trivial implementation of ARMv8.1-LOR leaves all of these | ||
23 | + * registers fixed at 0, which indicates that there are zero | ||
24 | + * supported Limited Ordering regions. | ||
25 | + */ | ||
26 | +static const ARMCPRegInfo lor_reginfo[] = { | ||
27 | + { .name = "LORSA_EL1", .state = ARM_CP_STATE_AA64, | ||
28 | + .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 0, | ||
29 | + .access = PL1_RW, .accessfn = access_lor_other, | ||
30 | + .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
31 | + { .name = "LOREA_EL1", .state = ARM_CP_STATE_AA64, | ||
32 | + .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 1, | ||
33 | + .access = PL1_RW, .accessfn = access_lor_other, | ||
34 | + .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
35 | + { .name = "LORN_EL1", .state = ARM_CP_STATE_AA64, | ||
36 | + .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 2, | ||
37 | + .access = PL1_RW, .accessfn = access_lor_other, | ||
38 | + .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
39 | + { .name = "LORC_EL1", .state = ARM_CP_STATE_AA64, | ||
40 | + .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 3, | ||
41 | + .access = PL1_RW, .accessfn = access_lor_other, | ||
42 | + .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
43 | + { .name = "LORID_EL1", .state = ARM_CP_STATE_AA64, | ||
44 | + .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 7, | ||
45 | + .access = PL1_R, .accessfn = access_lorid, | ||
46 | + .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
47 | + REGINFO_SENTINEL | ||
48 | +}; | ||
49 | + | ||
50 | #ifdef TARGET_AARCH64 | ||
51 | static CPAccessResult access_pauth(CPUARMState *env, const ARMCPRegInfo *ri, | ||
52 | bool isread) | ||
53 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
54 | } | 26 | } |
55 | 27 | ||
56 | if (cpu_isar_feature(aa64_lor, cpu)) { | 28 | - if (el < 2 && env->cp15.hstr_el2 && |
57 | - /* | 29 | + if (el < 2 && env->cp15.hstr_el2 && arm_is_el2_enabled(env) && |
58 | - * A trivial implementation of ARMv8.1-LOR leaves all of these | 30 | (arm_hcr_el2_eff(env) & (HCR_E2H | HCR_TGE)) != (HCR_E2H | HCR_TGE)) { |
59 | - * registers fixed at 0, which indicates that there are zero | 31 | DP_TBFLAG_A32(flags, HSTR_ACTIVE, 1); |
60 | - * supported Limited Ordering regions. | ||
61 | - */ | ||
62 | - static const ARMCPRegInfo lor_reginfo[] = { | ||
63 | - { .name = "LORSA_EL1", .state = ARM_CP_STATE_AA64, | ||
64 | - .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 0, | ||
65 | - .access = PL1_RW, .accessfn = access_lor_other, | ||
66 | - .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
67 | - { .name = "LOREA_EL1", .state = ARM_CP_STATE_AA64, | ||
68 | - .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 1, | ||
69 | - .access = PL1_RW, .accessfn = access_lor_other, | ||
70 | - .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
71 | - { .name = "LORN_EL1", .state = ARM_CP_STATE_AA64, | ||
72 | - .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 2, | ||
73 | - .access = PL1_RW, .accessfn = access_lor_other, | ||
74 | - .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
75 | - { .name = "LORC_EL1", .state = ARM_CP_STATE_AA64, | ||
76 | - .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 3, | ||
77 | - .access = PL1_RW, .accessfn = access_lor_other, | ||
78 | - .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
79 | - { .name = "LORID_EL1", .state = ARM_CP_STATE_AA64, | ||
80 | - .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 7, | ||
81 | - .access = PL1_R, .accessfn = access_lorid, | ||
82 | - .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
83 | - REGINFO_SENTINEL | ||
84 | - }; | ||
85 | define_arm_cp_regs(cpu, lor_reginfo); | ||
86 | } | 32 | } |
33 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c | ||
34 | index XXXXXXX..XXXXXXX 100644 | ||
35 | --- a/target/arm/op_helper.c | ||
36 | +++ b/target/arm/op_helper.c | ||
37 | @@ -XXX,XX +XXX,XX @@ const void *HELPER(access_check_cp_reg)(CPUARMState *env, uint32_t key, | ||
38 | * we only need to check here for traps from EL0. | ||
39 | */ | ||
40 | if (!is_a64(env) && arm_current_el(env) == 0 && ri->cp == 15 && | ||
41 | + arm_is_el2_enabled(env) && | ||
42 | (arm_hcr_el2_eff(env) & (HCR_E2H | HCR_TGE)) != (HCR_E2H | HCR_TGE)) { | ||
43 | uint32_t mask = 1 << ri->crn; | ||
87 | 44 | ||
88 | -- | 45 | -- |
89 | 2.20.1 | 46 | 2.34.1 |
90 | |||
91 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | Define the system registers which are provided by the |
---|---|---|---|
2 | 2 | FEAT_FGT fine-grained trap architectural feature: | |
3 | Include definitions for all of the bits in ID_MMFR3. | 3 | HFGRTR_EL2, HFGWTR_EL2, HDFGRTR_EL2, HDFGWTR_EL2, HFGITR_EL2 |
4 | We already have a definition for ID_AA64MMFR1.PAN. | 4 | |
5 | 5 | All these registers are a set of bit fields, where each bit is set | |
6 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 6 | for a trap and clear to not trap on a particular system register |
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 7 | access. The R and W register pairs are for system registers, |
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 8 | allowing trapping to be done separately for reads and writes; the I |
9 | Message-id: 20200208125816.14954-4-richard.henderson@linaro.org | 9 | register is for system instructions where trapping is on instruction |
10 | execution. | ||
11 | |||
12 | The data storage in the CPU state struct is arranged as a set of | ||
13 | arrays rather than separate fields so that when we're looking up the | ||
14 | bits for a system register access we can just index into the array | ||
15 | rather than having to use a switch to select a named struct member. | ||
16 | The later FEAT_FGT2 will add extra elements to these arrays. | ||
17 | |||
18 | The field definitions for the new registers are in cpregs.h because | ||
19 | in practice the code that needs them is code that also needs | ||
20 | the cpregs information; cpu.h is included in a lot more files. | ||
21 | We're also going to add some FGT-specific definitions to cpregs.h | ||
22 | in the next commit. | ||
23 | |||
24 | We do not implement HAFGRTR_EL2, because we don't implement | ||
25 | FEAT_AMUv1. | ||
26 | |||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 27 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
28 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
29 | Tested-by: Fuad Tabba <tabba@google.com> | ||
30 | Message-id: 20230130182459.3309057-9-peter.maydell@linaro.org | ||
31 | Message-id: 20230127175507.2895013-9-peter.maydell@linaro.org | ||
11 | --- | 32 | --- |
12 | target/arm/cpu.h | 29 +++++++++++++++++++++++++++++ | 33 | target/arm/cpregs.h | 285 ++++++++++++++++++++++++++++++++++++++++++++ |
13 | 1 file changed, 29 insertions(+) | 34 | target/arm/cpu.h | 15 +++ |
14 | 35 | target/arm/helper.c | 40 +++++++ | |
36 | 3 files changed, 340 insertions(+) | ||
37 | |||
38 | diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/target/arm/cpregs.h | ||
41 | +++ b/target/arm/cpregs.h | ||
42 | @@ -XXX,XX +XXX,XX @@ typedef enum CPAccessResult { | ||
43 | CP_ACCESS_TRAP_UNCATEGORIZED = (2 << 2), | ||
44 | } CPAccessResult; | ||
45 | |||
46 | +/* Indexes into fgt_read[] */ | ||
47 | +#define FGTREG_HFGRTR 0 | ||
48 | +#define FGTREG_HDFGRTR 1 | ||
49 | +/* Indexes into fgt_write[] */ | ||
50 | +#define FGTREG_HFGWTR 0 | ||
51 | +#define FGTREG_HDFGWTR 1 | ||
52 | +/* Indexes into fgt_exec[] */ | ||
53 | +#define FGTREG_HFGITR 0 | ||
54 | + | ||
55 | +FIELD(HFGRTR_EL2, AFSR0_EL1, 0, 1) | ||
56 | +FIELD(HFGRTR_EL2, AFSR1_EL1, 1, 1) | ||
57 | +FIELD(HFGRTR_EL2, AIDR_EL1, 2, 1) | ||
58 | +FIELD(HFGRTR_EL2, AMAIR_EL1, 3, 1) | ||
59 | +FIELD(HFGRTR_EL2, APDAKEY, 4, 1) | ||
60 | +FIELD(HFGRTR_EL2, APDBKEY, 5, 1) | ||
61 | +FIELD(HFGRTR_EL2, APGAKEY, 6, 1) | ||
62 | +FIELD(HFGRTR_EL2, APIAKEY, 7, 1) | ||
63 | +FIELD(HFGRTR_EL2, APIBKEY, 8, 1) | ||
64 | +FIELD(HFGRTR_EL2, CCSIDR_EL1, 9, 1) | ||
65 | +FIELD(HFGRTR_EL2, CLIDR_EL1, 10, 1) | ||
66 | +FIELD(HFGRTR_EL2, CONTEXTIDR_EL1, 11, 1) | ||
67 | +FIELD(HFGRTR_EL2, CPACR_EL1, 12, 1) | ||
68 | +FIELD(HFGRTR_EL2, CSSELR_EL1, 13, 1) | ||
69 | +FIELD(HFGRTR_EL2, CTR_EL0, 14, 1) | ||
70 | +FIELD(HFGRTR_EL2, DCZID_EL0, 15, 1) | ||
71 | +FIELD(HFGRTR_EL2, ESR_EL1, 16, 1) | ||
72 | +FIELD(HFGRTR_EL2, FAR_EL1, 17, 1) | ||
73 | +FIELD(HFGRTR_EL2, ISR_EL1, 18, 1) | ||
74 | +FIELD(HFGRTR_EL2, LORC_EL1, 19, 1) | ||
75 | +FIELD(HFGRTR_EL2, LOREA_EL1, 20, 1) | ||
76 | +FIELD(HFGRTR_EL2, LORID_EL1, 21, 1) | ||
77 | +FIELD(HFGRTR_EL2, LORN_EL1, 22, 1) | ||
78 | +FIELD(HFGRTR_EL2, LORSA_EL1, 23, 1) | ||
79 | +FIELD(HFGRTR_EL2, MAIR_EL1, 24, 1) | ||
80 | +FIELD(HFGRTR_EL2, MIDR_EL1, 25, 1) | ||
81 | +FIELD(HFGRTR_EL2, MPIDR_EL1, 26, 1) | ||
82 | +FIELD(HFGRTR_EL2, PAR_EL1, 27, 1) | ||
83 | +FIELD(HFGRTR_EL2, REVIDR_EL1, 28, 1) | ||
84 | +FIELD(HFGRTR_EL2, SCTLR_EL1, 29, 1) | ||
85 | +FIELD(HFGRTR_EL2, SCXTNUM_EL1, 30, 1) | ||
86 | +FIELD(HFGRTR_EL2, SCXTNUM_EL0, 31, 1) | ||
87 | +FIELD(HFGRTR_EL2, TCR_EL1, 32, 1) | ||
88 | +FIELD(HFGRTR_EL2, TPIDR_EL1, 33, 1) | ||
89 | +FIELD(HFGRTR_EL2, TPIDRRO_EL0, 34, 1) | ||
90 | +FIELD(HFGRTR_EL2, TPIDR_EL0, 35, 1) | ||
91 | +FIELD(HFGRTR_EL2, TTBR0_EL1, 36, 1) | ||
92 | +FIELD(HFGRTR_EL2, TTBR1_EL1, 37, 1) | ||
93 | +FIELD(HFGRTR_EL2, VBAR_EL1, 38, 1) | ||
94 | +FIELD(HFGRTR_EL2, ICC_IGRPENN_EL1, 39, 1) | ||
95 | +FIELD(HFGRTR_EL2, ERRIDR_EL1, 40, 1) | ||
96 | +FIELD(HFGRTR_EL2, ERRSELR_EL1, 41, 1) | ||
97 | +FIELD(HFGRTR_EL2, ERXFR_EL1, 42, 1) | ||
98 | +FIELD(HFGRTR_EL2, ERXCTLR_EL1, 43, 1) | ||
99 | +FIELD(HFGRTR_EL2, ERXSTATUS_EL1, 44, 1) | ||
100 | +FIELD(HFGRTR_EL2, ERXMISCN_EL1, 45, 1) | ||
101 | +FIELD(HFGRTR_EL2, ERXPFGF_EL1, 46, 1) | ||
102 | +FIELD(HFGRTR_EL2, ERXPFGCTL_EL1, 47, 1) | ||
103 | +FIELD(HFGRTR_EL2, ERXPFGCDN_EL1, 48, 1) | ||
104 | +FIELD(HFGRTR_EL2, ERXADDR_EL1, 49, 1) | ||
105 | +FIELD(HFGRTR_EL2, NACCDATA_EL1, 50, 1) | ||
106 | +/* 51-53: RES0 */ | ||
107 | +FIELD(HFGRTR_EL2, NSMPRI_EL1, 54, 1) | ||
108 | +FIELD(HFGRTR_EL2, NTPIDR2_EL0, 55, 1) | ||
109 | +/* 56-63: RES0 */ | ||
110 | + | ||
111 | +/* These match HFGRTR but bits for RO registers are RES0 */ | ||
112 | +FIELD(HFGWTR_EL2, AFSR0_EL1, 0, 1) | ||
113 | +FIELD(HFGWTR_EL2, AFSR1_EL1, 1, 1) | ||
114 | +FIELD(HFGWTR_EL2, AMAIR_EL1, 3, 1) | ||
115 | +FIELD(HFGWTR_EL2, APDAKEY, 4, 1) | ||
116 | +FIELD(HFGWTR_EL2, APDBKEY, 5, 1) | ||
117 | +FIELD(HFGWTR_EL2, APGAKEY, 6, 1) | ||
118 | +FIELD(HFGWTR_EL2, APIAKEY, 7, 1) | ||
119 | +FIELD(HFGWTR_EL2, APIBKEY, 8, 1) | ||
120 | +FIELD(HFGWTR_EL2, CONTEXTIDR_EL1, 11, 1) | ||
121 | +FIELD(HFGWTR_EL2, CPACR_EL1, 12, 1) | ||
122 | +FIELD(HFGWTR_EL2, CSSELR_EL1, 13, 1) | ||
123 | +FIELD(HFGWTR_EL2, ESR_EL1, 16, 1) | ||
124 | +FIELD(HFGWTR_EL2, FAR_EL1, 17, 1) | ||
125 | +FIELD(HFGWTR_EL2, LORC_EL1, 19, 1) | ||
126 | +FIELD(HFGWTR_EL2, LOREA_EL1, 20, 1) | ||
127 | +FIELD(HFGWTR_EL2, LORN_EL1, 22, 1) | ||
128 | +FIELD(HFGWTR_EL2, LORSA_EL1, 23, 1) | ||
129 | +FIELD(HFGWTR_EL2, MAIR_EL1, 24, 1) | ||
130 | +FIELD(HFGWTR_EL2, PAR_EL1, 27, 1) | ||
131 | +FIELD(HFGWTR_EL2, SCTLR_EL1, 29, 1) | ||
132 | +FIELD(HFGWTR_EL2, SCXTNUM_EL1, 30, 1) | ||
133 | +FIELD(HFGWTR_EL2, SCXTNUM_EL0, 31, 1) | ||
134 | +FIELD(HFGWTR_EL2, TCR_EL1, 32, 1) | ||
135 | +FIELD(HFGWTR_EL2, TPIDR_EL1, 33, 1) | ||
136 | +FIELD(HFGWTR_EL2, TPIDRRO_EL0, 34, 1) | ||
137 | +FIELD(HFGWTR_EL2, TPIDR_EL0, 35, 1) | ||
138 | +FIELD(HFGWTR_EL2, TTBR0_EL1, 36, 1) | ||
139 | +FIELD(HFGWTR_EL2, TTBR1_EL1, 37, 1) | ||
140 | +FIELD(HFGWTR_EL2, VBAR_EL1, 38, 1) | ||
141 | +FIELD(HFGWTR_EL2, ICC_IGRPENN_EL1, 39, 1) | ||
142 | +FIELD(HFGWTR_EL2, ERRSELR_EL1, 41, 1) | ||
143 | +FIELD(HFGWTR_EL2, ERXCTLR_EL1, 43, 1) | ||
144 | +FIELD(HFGWTR_EL2, ERXSTATUS_EL1, 44, 1) | ||
145 | +FIELD(HFGWTR_EL2, ERXMISCN_EL1, 45, 1) | ||
146 | +FIELD(HFGWTR_EL2, ERXPFGCTL_EL1, 47, 1) | ||
147 | +FIELD(HFGWTR_EL2, ERXPFGCDN_EL1, 48, 1) | ||
148 | +FIELD(HFGWTR_EL2, ERXADDR_EL1, 49, 1) | ||
149 | +FIELD(HFGWTR_EL2, NACCDATA_EL1, 50, 1) | ||
150 | +FIELD(HFGWTR_EL2, NSMPRI_EL1, 54, 1) | ||
151 | +FIELD(HFGWTR_EL2, NTPIDR2_EL0, 55, 1) | ||
152 | + | ||
153 | +FIELD(HFGITR_EL2, ICIALLUIS, 0, 1) | ||
154 | +FIELD(HFGITR_EL2, ICIALLU, 1, 1) | ||
155 | +FIELD(HFGITR_EL2, ICIVAU, 2, 1) | ||
156 | +FIELD(HFGITR_EL2, DCIVAC, 3, 1) | ||
157 | +FIELD(HFGITR_EL2, DCISW, 4, 1) | ||
158 | +FIELD(HFGITR_EL2, DCCSW, 5, 1) | ||
159 | +FIELD(HFGITR_EL2, DCCISW, 6, 1) | ||
160 | +FIELD(HFGITR_EL2, DCCVAU, 7, 1) | ||
161 | +FIELD(HFGITR_EL2, DCCVAP, 8, 1) | ||
162 | +FIELD(HFGITR_EL2, DCCVADP, 9, 1) | ||
163 | +FIELD(HFGITR_EL2, DCCIVAC, 10, 1) | ||
164 | +FIELD(HFGITR_EL2, DCZVA, 11, 1) | ||
165 | +FIELD(HFGITR_EL2, ATS1E1R, 12, 1) | ||
166 | +FIELD(HFGITR_EL2, ATS1E1W, 13, 1) | ||
167 | +FIELD(HFGITR_EL2, ATS1E0R, 14, 1) | ||
168 | +FIELD(HFGITR_EL2, ATS1E0W, 15, 1) | ||
169 | +FIELD(HFGITR_EL2, ATS1E1RP, 16, 1) | ||
170 | +FIELD(HFGITR_EL2, ATS1E1WP, 17, 1) | ||
171 | +FIELD(HFGITR_EL2, TLBIVMALLE1OS, 18, 1) | ||
172 | +FIELD(HFGITR_EL2, TLBIVAE1OS, 19, 1) | ||
173 | +FIELD(HFGITR_EL2, TLBIASIDE1OS, 20, 1) | ||
174 | +FIELD(HFGITR_EL2, TLBIVAAE1OS, 21, 1) | ||
175 | +FIELD(HFGITR_EL2, TLBIVALE1OS, 22, 1) | ||
176 | +FIELD(HFGITR_EL2, TLBIVAALE1OS, 23, 1) | ||
177 | +FIELD(HFGITR_EL2, TLBIRVAE1OS, 24, 1) | ||
178 | +FIELD(HFGITR_EL2, TLBIRVAAE1OS, 25, 1) | ||
179 | +FIELD(HFGITR_EL2, TLBIRVALE1OS, 26, 1) | ||
180 | +FIELD(HFGITR_EL2, TLBIRVAALE1OS, 27, 1) | ||
181 | +FIELD(HFGITR_EL2, TLBIVMALLE1IS, 28, 1) | ||
182 | +FIELD(HFGITR_EL2, TLBIVAE1IS, 29, 1) | ||
183 | +FIELD(HFGITR_EL2, TLBIASIDE1IS, 30, 1) | ||
184 | +FIELD(HFGITR_EL2, TLBIVAAE1IS, 31, 1) | ||
185 | +FIELD(HFGITR_EL2, TLBIVALE1IS, 32, 1) | ||
186 | +FIELD(HFGITR_EL2, TLBIVAALE1IS, 33, 1) | ||
187 | +FIELD(HFGITR_EL2, TLBIRVAE1IS, 34, 1) | ||
188 | +FIELD(HFGITR_EL2, TLBIRVAAE1IS, 35, 1) | ||
189 | +FIELD(HFGITR_EL2, TLBIRVALE1IS, 36, 1) | ||
190 | +FIELD(HFGITR_EL2, TLBIRVAALE1IS, 37, 1) | ||
191 | +FIELD(HFGITR_EL2, TLBIRVAE1, 38, 1) | ||
192 | +FIELD(HFGITR_EL2, TLBIRVAAE1, 39, 1) | ||
193 | +FIELD(HFGITR_EL2, TLBIRVALE1, 40, 1) | ||
194 | +FIELD(HFGITR_EL2, TLBIRVAALE1, 41, 1) | ||
195 | +FIELD(HFGITR_EL2, TLBIVMALLE1, 42, 1) | ||
196 | +FIELD(HFGITR_EL2, TLBIVAE1, 43, 1) | ||
197 | +FIELD(HFGITR_EL2, TLBIASIDE1, 44, 1) | ||
198 | +FIELD(HFGITR_EL2, TLBIVAAE1, 45, 1) | ||
199 | +FIELD(HFGITR_EL2, TLBIVALE1, 46, 1) | ||
200 | +FIELD(HFGITR_EL2, TLBIVAALE1, 47, 1) | ||
201 | +FIELD(HFGITR_EL2, CFPRCTX, 48, 1) | ||
202 | +FIELD(HFGITR_EL2, DVPRCTX, 49, 1) | ||
203 | +FIELD(HFGITR_EL2, CPPRCTX, 50, 1) | ||
204 | +FIELD(HFGITR_EL2, ERET, 51, 1) | ||
205 | +FIELD(HFGITR_EL2, SVC_EL0, 52, 1) | ||
206 | +FIELD(HFGITR_EL2, SVC_EL1, 53, 1) | ||
207 | +FIELD(HFGITR_EL2, DCCVAC, 54, 1) | ||
208 | +FIELD(HFGITR_EL2, NBRBINJ, 55, 1) | ||
209 | +FIELD(HFGITR_EL2, NBRBIALL, 56, 1) | ||
210 | + | ||
211 | +FIELD(HDFGRTR_EL2, DBGBCRN_EL1, 0, 1) | ||
212 | +FIELD(HDFGRTR_EL2, DBGBVRN_EL1, 1, 1) | ||
213 | +FIELD(HDFGRTR_EL2, DBGWCRN_EL1, 2, 1) | ||
214 | +FIELD(HDFGRTR_EL2, DBGWVRN_EL1, 3, 1) | ||
215 | +FIELD(HDFGRTR_EL2, MDSCR_EL1, 4, 1) | ||
216 | +FIELD(HDFGRTR_EL2, DBGCLAIM, 5, 1) | ||
217 | +FIELD(HDFGRTR_EL2, DBGAUTHSTATUS_EL1, 6, 1) | ||
218 | +FIELD(HDFGRTR_EL2, DBGPRCR_EL1, 7, 1) | ||
219 | +/* 8: RES0: OSLAR_EL1 is WO */ | ||
220 | +FIELD(HDFGRTR_EL2, OSLSR_EL1, 9, 1) | ||
221 | +FIELD(HDFGRTR_EL2, OSECCR_EL1, 10, 1) | ||
222 | +FIELD(HDFGRTR_EL2, OSDLR_EL1, 11, 1) | ||
223 | +FIELD(HDFGRTR_EL2, PMEVCNTRN_EL0, 12, 1) | ||
224 | +FIELD(HDFGRTR_EL2, PMEVTYPERN_EL0, 13, 1) | ||
225 | +FIELD(HDFGRTR_EL2, PMCCFILTR_EL0, 14, 1) | ||
226 | +FIELD(HDFGRTR_EL2, PMCCNTR_EL0, 15, 1) | ||
227 | +FIELD(HDFGRTR_EL2, PMCNTEN, 16, 1) | ||
228 | +FIELD(HDFGRTR_EL2, PMINTEN, 17, 1) | ||
229 | +FIELD(HDFGRTR_EL2, PMOVS, 18, 1) | ||
230 | +FIELD(HDFGRTR_EL2, PMSELR_EL0, 19, 1) | ||
231 | +/* 20: RES0: PMSWINC_EL0 is WO */ | ||
232 | +/* 21: RES0: PMCR_EL0 is WO */ | ||
233 | +FIELD(HDFGRTR_EL2, PMMIR_EL1, 22, 1) | ||
234 | +FIELD(HDFGRTR_EL2, PMBLIMITR_EL1, 23, 1) | ||
235 | +FIELD(HDFGRTR_EL2, PMBPTR_EL1, 24, 1) | ||
236 | +FIELD(HDFGRTR_EL2, PMBSR_EL1, 25, 1) | ||
237 | +FIELD(HDFGRTR_EL2, PMSCR_EL1, 26, 1) | ||
238 | +FIELD(HDFGRTR_EL2, PMSEVFR_EL1, 27, 1) | ||
239 | +FIELD(HDFGRTR_EL2, PMSFCR_EL1, 28, 1) | ||
240 | +FIELD(HDFGRTR_EL2, PMSICR_EL1, 29, 1) | ||
241 | +FIELD(HDFGRTR_EL2, PMSIDR_EL1, 30, 1) | ||
242 | +FIELD(HDFGRTR_EL2, PMSIRR_EL1, 31, 1) | ||
243 | +FIELD(HDFGRTR_EL2, PMSLATFR_EL1, 32, 1) | ||
244 | +FIELD(HDFGRTR_EL2, TRC, 33, 1) | ||
245 | +FIELD(HDFGRTR_EL2, TRCAUTHSTATUS, 34, 1) | ||
246 | +FIELD(HDFGRTR_EL2, TRCAUXCTLR, 35, 1) | ||
247 | +FIELD(HDFGRTR_EL2, TRCCLAIM, 36, 1) | ||
248 | +FIELD(HDFGRTR_EL2, TRCCNTVRn, 37, 1) | ||
249 | +/* 38, 39: RES0 */ | ||
250 | +FIELD(HDFGRTR_EL2, TRCID, 40, 1) | ||
251 | +FIELD(HDFGRTR_EL2, TRCIMSPECN, 41, 1) | ||
252 | +/* 42: RES0: TRCOSLAR is WO */ | ||
253 | +FIELD(HDFGRTR_EL2, TRCOSLSR, 43, 1) | ||
254 | +FIELD(HDFGRTR_EL2, TRCPRGCTLR, 44, 1) | ||
255 | +FIELD(HDFGRTR_EL2, TRCSEQSTR, 45, 1) | ||
256 | +FIELD(HDFGRTR_EL2, TRCSSCSRN, 46, 1) | ||
257 | +FIELD(HDFGRTR_EL2, TRCSTATR, 47, 1) | ||
258 | +FIELD(HDFGRTR_EL2, TRCVICTLR, 48, 1) | ||
259 | +/* 49: RES0: TRFCR_EL1 is WO */ | ||
260 | +FIELD(HDFGRTR_EL2, TRBBASER_EL1, 50, 1) | ||
261 | +FIELD(HDFGRTR_EL2, TRBIDR_EL1, 51, 1) | ||
262 | +FIELD(HDFGRTR_EL2, TRBLIMITR_EL1, 52, 1) | ||
263 | +FIELD(HDFGRTR_EL2, TRBMAR_EL1, 53, 1) | ||
264 | +FIELD(HDFGRTR_EL2, TRBPTR_EL1, 54, 1) | ||
265 | +FIELD(HDFGRTR_EL2, TRBSR_EL1, 55, 1) | ||
266 | +FIELD(HDFGRTR_EL2, TRBTRG_EL1, 56, 1) | ||
267 | +FIELD(HDFGRTR_EL2, PMUSERENR_EL0, 57, 1) | ||
268 | +FIELD(HDFGRTR_EL2, PMCEIDN_EL0, 58, 1) | ||
269 | +FIELD(HDFGRTR_EL2, NBRBIDR, 59, 1) | ||
270 | +FIELD(HDFGRTR_EL2, NBRBCTL, 60, 1) | ||
271 | +FIELD(HDFGRTR_EL2, NBRBDATA, 61, 1) | ||
272 | +FIELD(HDFGRTR_EL2, NPMSNEVFR_EL1, 62, 1) | ||
273 | +FIELD(HDFGRTR_EL2, PMBIDR_EL1, 63, 1) | ||
274 | + | ||
275 | +/* | ||
276 | + * These match HDFGRTR_EL2, but bits for RO registers are RES0. | ||
277 | + * A few bits are for WO registers, where the HDFGRTR_EL2 bit is RES0. | ||
278 | + */ | ||
279 | +FIELD(HDFGWTR_EL2, DBGBCRN_EL1, 0, 1) | ||
280 | +FIELD(HDFGWTR_EL2, DBGBVRN_EL1, 1, 1) | ||
281 | +FIELD(HDFGWTR_EL2, DBGWCRN_EL1, 2, 1) | ||
282 | +FIELD(HDFGWTR_EL2, DBGWVRN_EL1, 3, 1) | ||
283 | +FIELD(HDFGWTR_EL2, MDSCR_EL1, 4, 1) | ||
284 | +FIELD(HDFGWTR_EL2, DBGCLAIM, 5, 1) | ||
285 | +FIELD(HDFGWTR_EL2, DBGPRCR_EL1, 7, 1) | ||
286 | +FIELD(HDFGWTR_EL2, OSLAR_EL1, 8, 1) | ||
287 | +FIELD(HDFGWTR_EL2, OSLSR_EL1, 9, 1) | ||
288 | +FIELD(HDFGWTR_EL2, OSECCR_EL1, 10, 1) | ||
289 | +FIELD(HDFGWTR_EL2, OSDLR_EL1, 11, 1) | ||
290 | +FIELD(HDFGWTR_EL2, PMEVCNTRN_EL0, 12, 1) | ||
291 | +FIELD(HDFGWTR_EL2, PMEVTYPERN_EL0, 13, 1) | ||
292 | +FIELD(HDFGWTR_EL2, PMCCFILTR_EL0, 14, 1) | ||
293 | +FIELD(HDFGWTR_EL2, PMCCNTR_EL0, 15, 1) | ||
294 | +FIELD(HDFGWTR_EL2, PMCNTEN, 16, 1) | ||
295 | +FIELD(HDFGWTR_EL2, PMINTEN, 17, 1) | ||
296 | +FIELD(HDFGWTR_EL2, PMOVS, 18, 1) | ||
297 | +FIELD(HDFGWTR_EL2, PMSELR_EL0, 19, 1) | ||
298 | +FIELD(HDFGWTR_EL2, PMSWINC_EL0, 20, 1) | ||
299 | +FIELD(HDFGWTR_EL2, PMCR_EL0, 21, 1) | ||
300 | +FIELD(HDFGWTR_EL2, PMBLIMITR_EL1, 23, 1) | ||
301 | +FIELD(HDFGWTR_EL2, PMBPTR_EL1, 24, 1) | ||
302 | +FIELD(HDFGWTR_EL2, PMBSR_EL1, 25, 1) | ||
303 | +FIELD(HDFGWTR_EL2, PMSCR_EL1, 26, 1) | ||
304 | +FIELD(HDFGWTR_EL2, PMSEVFR_EL1, 27, 1) | ||
305 | +FIELD(HDFGWTR_EL2, PMSFCR_EL1, 28, 1) | ||
306 | +FIELD(HDFGWTR_EL2, PMSICR_EL1, 29, 1) | ||
307 | +FIELD(HDFGWTR_EL2, PMSIRR_EL1, 31, 1) | ||
308 | +FIELD(HDFGWTR_EL2, PMSLATFR_EL1, 32, 1) | ||
309 | +FIELD(HDFGWTR_EL2, TRC, 33, 1) | ||
310 | +FIELD(HDFGWTR_EL2, TRCAUXCTLR, 35, 1) | ||
311 | +FIELD(HDFGWTR_EL2, TRCCLAIM, 36, 1) | ||
312 | +FIELD(HDFGWTR_EL2, TRCCNTVRn, 37, 1) | ||
313 | +FIELD(HDFGWTR_EL2, TRCIMSPECN, 41, 1) | ||
314 | +FIELD(HDFGWTR_EL2, TRCOSLAR, 42, 1) | ||
315 | +FIELD(HDFGWTR_EL2, TRCPRGCTLR, 44, 1) | ||
316 | +FIELD(HDFGWTR_EL2, TRCSEQSTR, 45, 1) | ||
317 | +FIELD(HDFGWTR_EL2, TRCSSCSRN, 46, 1) | ||
318 | +FIELD(HDFGWTR_EL2, TRCVICTLR, 48, 1) | ||
319 | +FIELD(HDFGWTR_EL2, TRFCR_EL1, 49, 1) | ||
320 | +FIELD(HDFGWTR_EL2, TRBBASER_EL1, 50, 1) | ||
321 | +FIELD(HDFGWTR_EL2, TRBLIMITR_EL1, 52, 1) | ||
322 | +FIELD(HDFGWTR_EL2, TRBMAR_EL1, 53, 1) | ||
323 | +FIELD(HDFGWTR_EL2, TRBPTR_EL1, 54, 1) | ||
324 | +FIELD(HDFGWTR_EL2, TRBSR_EL1, 55, 1) | ||
325 | +FIELD(HDFGWTR_EL2, TRBTRG_EL1, 56, 1) | ||
326 | +FIELD(HDFGWTR_EL2, PMUSERENR_EL0, 57, 1) | ||
327 | +FIELD(HDFGWTR_EL2, NBRBCTL, 60, 1) | ||
328 | +FIELD(HDFGWTR_EL2, NBRBDATA, 61, 1) | ||
329 | +FIELD(HDFGWTR_EL2, NPMSNEVFR_EL1, 62, 1) | ||
330 | + | ||
331 | typedef struct ARMCPRegInfo ARMCPRegInfo; | ||
332 | |||
333 | /* | ||
15 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 334 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h |
16 | index XXXXXXX..XXXXXXX 100644 | 335 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/cpu.h | 336 | --- a/target/arm/cpu.h |
18 | +++ b/target/arm/cpu.h | 337 | +++ b/target/arm/cpu.h |
19 | @@ -XXX,XX +XXX,XX @@ FIELD(ID_ISAR6, FHM, 8, 4) | 338 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState { |
20 | FIELD(ID_ISAR6, SB, 12, 4) | 339 | uint64_t disr_el1; |
21 | FIELD(ID_ISAR6, SPECRES, 16, 4) | 340 | uint64_t vdisr_el2; |
22 | 341 | uint64_t vsesr_el2; | |
23 | +FIELD(ID_MMFR3, CMAINTVA, 0, 4) | 342 | + |
24 | +FIELD(ID_MMFR3, CMAINTSW, 4, 4) | 343 | + /* |
25 | +FIELD(ID_MMFR3, BPMAINT, 8, 4) | 344 | + * Fine-Grained Trap registers. We store these as arrays so the |
26 | +FIELD(ID_MMFR3, MAINTBCST, 12, 4) | 345 | + * access checking code doesn't have to manually select |
27 | +FIELD(ID_MMFR3, PAN, 16, 4) | 346 | + * HFGRTR_EL2 vs HFDFGRTR_EL2 etc when looking up the bit to test. |
28 | +FIELD(ID_MMFR3, COHWALK, 20, 4) | 347 | + * FEAT_FGT2 will add more elements to these arrays. |
29 | +FIELD(ID_MMFR3, CMEMSZ, 24, 4) | 348 | + */ |
30 | +FIELD(ID_MMFR3, SUPERSEC, 28, 4) | 349 | + uint64_t fgt_read[2]; /* HFGRTR, HDFGRTR */ |
31 | + | 350 | + uint64_t fgt_write[2]; /* HFGWTR, HDFGWTR */ |
32 | FIELD(ID_MMFR4, SPECSEI, 0, 4) | 351 | + uint64_t fgt_exec[1]; /* HFGITR */ |
33 | FIELD(ID_MMFR4, AC2, 4, 4) | 352 | } cp15; |
34 | FIELD(ID_MMFR4, XNX, 8, 4) | 353 | |
35 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa32_vminmaxnm(const ARMISARegisters *id) | 354 | struct { |
36 | return FIELD_EX64(id->mvfr2, MVFR2, FPMISC) >= 4; | 355 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_tgran64_2(const ARMISARegisters *id) |
356 | return t >= 2 || (t == 0 && isar_feature_aa64_tgran64(id)); | ||
37 | } | 357 | } |
38 | 358 | ||
39 | +static inline bool isar_feature_aa32_pan(const ARMISARegisters *id) | 359 | +static inline bool isar_feature_aa64_fgt(const ARMISARegisters *id) |
40 | +{ | 360 | +{ |
41 | + return FIELD_EX64(id->mvfr0, ID_MMFR3, PAN) != 0; | 361 | + return FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, FGT) != 0; |
42 | +} | 362 | +} |
43 | + | 363 | + |
44 | +static inline bool isar_feature_aa32_ats1e1(const ARMISARegisters *id) | 364 | static inline bool isar_feature_aa64_ccidx(const ARMISARegisters *id) |
365 | { | ||
366 | return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, CCIDX) != 0; | ||
367 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
368 | index XXXXXXX..XXXXXXX 100644 | ||
369 | --- a/target/arm/helper.c | ||
370 | +++ b/target/arm/helper.c | ||
371 | @@ -XXX,XX +XXX,XX @@ static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) | ||
372 | if (cpu_isar_feature(aa64_hcx, cpu)) { | ||
373 | valid_mask |= SCR_HXEN; | ||
374 | } | ||
375 | + if (cpu_isar_feature(aa64_fgt, cpu)) { | ||
376 | + valid_mask |= SCR_FGTEN; | ||
377 | + } | ||
378 | } else { | ||
379 | valid_mask &= ~(SCR_RW | SCR_ST); | ||
380 | if (cpu_isar_feature(aa32_ras, cpu)) { | ||
381 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo scxtnum_reginfo[] = { | ||
382 | .access = PL3_RW, | ||
383 | .fieldoffset = offsetof(CPUARMState, scxtnum_el[3]) }, | ||
384 | }; | ||
385 | + | ||
386 | +static CPAccessResult access_fgt(CPUARMState *env, const ARMCPRegInfo *ri, | ||
387 | + bool isread) | ||
45 | +{ | 388 | +{ |
46 | + return FIELD_EX64(id->mvfr0, ID_MMFR3, PAN) >= 2; | 389 | + if (arm_current_el(env) == 2 && |
390 | + arm_feature(env, ARM_FEATURE_EL3) && !(env->cp15.scr_el3 & SCR_FGTEN)) { | ||
391 | + return CP_ACCESS_TRAP_EL3; | ||
392 | + } | ||
393 | + return CP_ACCESS_OK; | ||
47 | +} | 394 | +} |
48 | + | 395 | + |
49 | /* | 396 | +static const ARMCPRegInfo fgt_reginfo[] = { |
50 | * 64-bit feature tests via id registers. | 397 | + { .name = "HFGRTR_EL2", .state = ARM_CP_STATE_AA64, |
51 | */ | 398 | + .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 4, |
52 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_lor(const ARMISARegisters *id) | 399 | + .access = PL2_RW, .accessfn = access_fgt, |
53 | return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, LO) != 0; | 400 | + .fieldoffset = offsetof(CPUARMState, cp15.fgt_read[FGTREG_HFGRTR]) }, |
54 | } | 401 | + { .name = "HFGWTR_EL2", .state = ARM_CP_STATE_AA64, |
55 | 402 | + .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 5, | |
56 | +static inline bool isar_feature_aa64_pan(const ARMISARegisters *id) | 403 | + .access = PL2_RW, .accessfn = access_fgt, |
57 | +{ | 404 | + .fieldoffset = offsetof(CPUARMState, cp15.fgt_write[FGTREG_HFGWTR]) }, |
58 | + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, PAN) != 0; | 405 | + { .name = "HDFGRTR_EL2", .state = ARM_CP_STATE_AA64, |
59 | +} | 406 | + .opc0 = 3, .opc1 = 4, .crn = 3, .crm = 1, .opc2 = 4, |
60 | + | 407 | + .access = PL2_RW, .accessfn = access_fgt, |
61 | +static inline bool isar_feature_aa64_ats1e1(const ARMISARegisters *id) | 408 | + .fieldoffset = offsetof(CPUARMState, cp15.fgt_read[FGTREG_HDFGRTR]) }, |
62 | +{ | 409 | + { .name = "HDFGWTR_EL2", .state = ARM_CP_STATE_AA64, |
63 | + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, PAN) >= 2; | 410 | + .opc0 = 3, .opc1 = 4, .crn = 3, .crm = 1, .opc2 = 5, |
64 | +} | 411 | + .access = PL2_RW, .accessfn = access_fgt, |
65 | + | 412 | + .fieldoffset = offsetof(CPUARMState, cp15.fgt_write[FGTREG_HDFGWTR]) }, |
66 | static inline bool isar_feature_aa64_bti(const ARMISARegisters *id) | 413 | + { .name = "HFGITR_EL2", .state = ARM_CP_STATE_AA64, |
67 | { | 414 | + .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 6, |
68 | return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, BT) != 0; | 415 | + .access = PL2_RW, .accessfn = access_fgt, |
416 | + .fieldoffset = offsetof(CPUARMState, cp15.fgt_exec[FGTREG_HFGITR]) }, | ||
417 | +}; | ||
418 | #endif /* TARGET_AARCH64 */ | ||
419 | |||
420 | static CPAccessResult access_predinv(CPUARMState *env, const ARMCPRegInfo *ri, | ||
421 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
422 | if (cpu_isar_feature(aa64_scxtnum, cpu)) { | ||
423 | define_arm_cp_regs(cpu, scxtnum_reginfo); | ||
424 | } | ||
425 | + | ||
426 | + if (cpu_isar_feature(aa64_fgt, cpu)) { | ||
427 | + define_arm_cp_regs(cpu, fgt_reginfo); | ||
428 | + } | ||
429 | #endif | ||
430 | |||
431 | if (cpu_isar_feature(any_predinv, cpu)) { | ||
69 | -- | 432 | -- |
70 | 2.20.1 | 433 | 2.34.1 |
71 | |||
72 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | Implement the machinery for fine-grained traps on normal sysregs. |
---|---|---|---|
2 | 2 | Any sysreg with a fine-grained trap will set the new field to | |
3 | To implement PAN, we will want to swap, for short periods | 3 | indicate which FGT register bit it should trap on. |
4 | of time, to a different privileged mmu_idx. In addition, | 4 | |
5 | we cannot do this with flushing alone, because the AT* | 5 | FGT traps only happen when an AArch64 EL2 enables them for |
6 | instructions have both PAN and PAN-less versions. | 6 | an AArch64 EL1. They therefore are only relevant for AArch32 |
7 | 7 | cpregs when the cpreg can be accessed from EL0. The logic | |
8 | Add the ARMMMUIdx*_PAN constants where necessary next to | 8 | in access_check_cp_reg() will check this, so it is safe to |
9 | the corresponding ARMMMUIdx* constant. | 9 | add a .fgt marking to an ARM_CP_STATE_BOTH ARMCPRegInfo. |
10 | 10 | ||
11 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 11 | The DO_BIT and DO_REV_BIT macros define enum constants FGT_##bitname |
12 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 12 | which can be used to specify the FGT bit, eg |
13 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 13 | .fgt = FGT_AFSR0_EL1 |
14 | Message-id: 20200208125816.14954-3-richard.henderson@linaro.org | 14 | (We assume that there is no bit name duplication across the FGT |
15 | registers, for brevity's sake.) | ||
16 | |||
17 | Subsequent commits will add the .fgt fields to the relevant register | ||
18 | definitions and define the FGT_nnn values for them. | ||
19 | |||
20 | Note that some of the FGT traps are for instructions that we don't | ||
21 | handle via the cpregs mechanisms (mostly these are instruction traps). | ||
22 | Those we will have to handle separately. | ||
23 | |||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 24 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
25 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
26 | Tested-by: Fuad Tabba <tabba@google.com> | ||
27 | Message-id: 20230130182459.3309057-10-peter.maydell@linaro.org | ||
28 | Message-id: 20230127175507.2895013-10-peter.maydell@linaro.org | ||
16 | --- | 29 | --- |
17 | target/arm/cpu-param.h | 2 +- | 30 | target/arm/cpregs.h | 72 ++++++++++++++++++++++++++++++++++++++ |
18 | target/arm/cpu.h | 33 ++++++++++++++------- | 31 | target/arm/cpu.h | 1 + |
19 | target/arm/internals.h | 9 ++++++ | 32 | target/arm/internals.h | 20 +++++++++++ |
20 | target/arm/helper.c | 60 +++++++++++++++++++++++++++++++------- | 33 | target/arm/translate.h | 2 ++ |
21 | target/arm/translate-a64.c | 3 ++ | 34 | target/arm/helper.c | 9 +++++ |
35 | target/arm/op_helper.c | 30 ++++++++++++++++ | ||
36 | target/arm/translate-a64.c | 3 +- | ||
22 | target/arm/translate.c | 2 ++ | 37 | target/arm/translate.c | 2 ++ |
23 | 6 files changed, 87 insertions(+), 22 deletions(-) | 38 | 8 files changed, 138 insertions(+), 1 deletion(-) |
24 | 39 | ||
25 | diff --git a/target/arm/cpu-param.h b/target/arm/cpu-param.h | 40 | diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h |
26 | index XXXXXXX..XXXXXXX 100644 | 41 | index XXXXXXX..XXXXXXX 100644 |
27 | --- a/target/arm/cpu-param.h | 42 | --- a/target/arm/cpregs.h |
28 | +++ b/target/arm/cpu-param.h | 43 | +++ b/target/arm/cpregs.h |
29 | @@ -XXX,XX +XXX,XX @@ | 44 | @@ -XXX,XX +XXX,XX @@ FIELD(HDFGWTR_EL2, NBRBCTL, 60, 1) |
30 | # define TARGET_PAGE_BITS_MIN 10 | 45 | FIELD(HDFGWTR_EL2, NBRBDATA, 61, 1) |
31 | #endif | 46 | FIELD(HDFGWTR_EL2, NPMSNEVFR_EL1, 62, 1) |
32 | 47 | ||
33 | -#define NB_MMU_MODES 9 | 48 | +/* Which fine-grained trap bit register to check, if any */ |
34 | +#define NB_MMU_MODES 12 | 49 | +FIELD(FGT, TYPE, 10, 3) |
35 | 50 | +FIELD(FGT, REV, 9, 1) /* Is bit sense reversed? */ | |
36 | #endif | 51 | +FIELD(FGT, IDX, 6, 3) /* Index within a uint64_t[] array */ |
52 | +FIELD(FGT, BITPOS, 0, 6) /* Bit position within the uint64_t */ | ||
53 | + | ||
54 | +/* | ||
55 | + * Macros to define FGT_##bitname enum constants to use in ARMCPRegInfo::fgt | ||
56 | + * fields. We assume for brevity's sake that there are no duplicated | ||
57 | + * bit names across the various FGT registers. | ||
58 | + */ | ||
59 | +#define DO_BIT(REG, BITNAME) \ | ||
60 | + FGT_##BITNAME = FGT_##REG | R_##REG##_EL2_##BITNAME##_SHIFT | ||
61 | + | ||
62 | +/* Some bits have reversed sense, so 0 means trap and 1 means not */ | ||
63 | +#define DO_REV_BIT(REG, BITNAME) \ | ||
64 | + FGT_##BITNAME = FGT_##REG | FGT_REV | R_##REG##_EL2_##BITNAME##_SHIFT | ||
65 | + | ||
66 | +typedef enum FGTBit { | ||
67 | + /* | ||
68 | + * These bits tell us which register arrays to use: | ||
69 | + * if FGT_R is set then reads are checked against fgt_read[]; | ||
70 | + * if FGT_W is set then writes are checked against fgt_write[]; | ||
71 | + * if FGT_EXEC is set then all accesses are checked against fgt_exec[]. | ||
72 | + * | ||
73 | + * For almost all bits in the R/W register pairs, the bit exists in | ||
74 | + * both registers for a RW register, in HFGRTR/HDFGRTR for a RO register | ||
75 | + * with the corresponding HFGWTR/HDFGTWTR bit being RES0, and vice-versa | ||
76 | + * for a WO register. There are unfortunately a couple of exceptions | ||
77 | + * (PMCR_EL0, TRFCR_EL1) where the register being trapped is RW but | ||
78 | + * the FGT system only allows trapping of writes, not reads. | ||
79 | + * | ||
80 | + * Note that we arrange these bits so that a 0 FGTBit means "no trap". | ||
81 | + */ | ||
82 | + FGT_R = 1 << R_FGT_TYPE_SHIFT, | ||
83 | + FGT_W = 2 << R_FGT_TYPE_SHIFT, | ||
84 | + FGT_EXEC = 4 << R_FGT_TYPE_SHIFT, | ||
85 | + FGT_RW = FGT_R | FGT_W, | ||
86 | + /* Bit to identify whether trap bit is reversed sense */ | ||
87 | + FGT_REV = R_FGT_REV_MASK, | ||
88 | + | ||
89 | + /* | ||
90 | + * If a bit exists in HFGRTR/HDFGRTR then either the register being | ||
91 | + * trapped is RO or the bit also exists in HFGWTR/HDFGWTR, so we either | ||
92 | + * want to trap for both reads and writes or else it's harmless to mark | ||
93 | + * it as trap-on-writes. | ||
94 | + * If a bit exists only in HFGWTR/HDFGWTR then either the register being | ||
95 | + * trapped is WO, or else it is one of the two oddball special cases | ||
96 | + * which are RW but have only a write trap. We mark these as only | ||
97 | + * FGT_W so we get the right behaviour for those special cases. | ||
98 | + * (If a bit was added in future that provided only a read trap for an | ||
99 | + * RW register we'd need to do something special to get the FGT_R bit | ||
100 | + * only. But this seems unlikely to happen.) | ||
101 | + * | ||
102 | + * So for the DO_BIT/DO_REV_BIT macros: use FGT_HFGRTR/FGT_HDFGRTR if | ||
103 | + * the bit exists in that register. Otherwise use FGT_HFGWTR/FGT_HDFGWTR. | ||
104 | + */ | ||
105 | + FGT_HFGRTR = FGT_RW | (FGTREG_HFGRTR << R_FGT_IDX_SHIFT), | ||
106 | + FGT_HFGWTR = FGT_W | (FGTREG_HFGWTR << R_FGT_IDX_SHIFT), | ||
107 | + FGT_HDFGRTR = FGT_RW | (FGTREG_HDFGRTR << R_FGT_IDX_SHIFT), | ||
108 | + FGT_HDFGWTR = FGT_W | (FGTREG_HDFGWTR << R_FGT_IDX_SHIFT), | ||
109 | + FGT_HFGITR = FGT_EXEC | (FGTREG_HFGITR << R_FGT_IDX_SHIFT), | ||
110 | +} FGTBit; | ||
111 | + | ||
112 | +#undef DO_BIT | ||
113 | +#undef DO_REV_BIT | ||
114 | + | ||
115 | typedef struct ARMCPRegInfo ARMCPRegInfo; | ||
116 | |||
117 | /* | ||
118 | @@ -XXX,XX +XXX,XX @@ struct ARMCPRegInfo { | ||
119 | CPAccessRights access; | ||
120 | /* Security state: ARM_CP_SECSTATE_* bits/values */ | ||
121 | CPSecureState secure; | ||
122 | + /* | ||
123 | + * Which fine-grained trap register bit to check, if any. This | ||
124 | + * value encodes both the trap register and bit within it. | ||
125 | + */ | ||
126 | + FGTBit fgt; | ||
127 | /* | ||
128 | * The opaque pointer passed to define_arm_cp_regs_with_opaque() when | ||
129 | * this register was defined: can be used to hand data through to the | ||
37 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 130 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h |
38 | index XXXXXXX..XXXXXXX 100644 | 131 | index XXXXXXX..XXXXXXX 100644 |
39 | --- a/target/arm/cpu.h | 132 | --- a/target/arm/cpu.h |
40 | +++ b/target/arm/cpu.h | 133 | +++ b/target/arm/cpu.h |
41 | @@ -XXX,XX +XXX,XX @@ bool write_cpustate_to_list(ARMCPU *cpu, bool kvm_sync); | 134 | @@ -XXX,XX +XXX,XX @@ FIELD(TBFLAG_ANY, FPEXC_EL, 8, 2) |
42 | * 5. we want to be able to use the TLB for accesses done as part of a | 135 | /* Memory operations require alignment: SCTLR_ELx.A or CCR.UNALIGN_TRP */ |
43 | * stage1 page table walk, rather than having to walk the stage2 page | 136 | FIELD(TBFLAG_ANY, ALIGN_MEM, 10, 1) |
44 | * table over and over. | 137 | FIELD(TBFLAG_ANY, PSTATE__IL, 11, 1) |
45 | + * 6. we need separate EL1/EL2 mmu_idx for handling the Privileged Access | 138 | +FIELD(TBFLAG_ANY, FGT_ACTIVE, 12, 1) |
46 | + * Never (PAN) bit within PSTATE. | 139 | |
47 | * | 140 | /* |
48 | * This gives us the following list of cases: | 141 | * Bit usage when in AArch32 state, both A- and M-profile. |
49 | * | ||
50 | * NS EL0 EL1&0 stage 1+2 (aka NS PL0) | ||
51 | * NS EL1 EL1&0 stage 1+2 (aka NS PL1) | ||
52 | + * NS EL1 EL1&0 stage 1+2 +PAN | ||
53 | * NS EL0 EL2&0 | ||
54 | - * NS EL2 EL2&0 | ||
55 | + * NS EL2 EL2&0 +PAN | ||
56 | * NS EL2 (aka NS PL2) | ||
57 | * S EL0 EL1&0 (aka S PL0) | ||
58 | * S EL1 EL1&0 (not used if EL3 is 32 bit) | ||
59 | + * S EL1 EL1&0 +PAN | ||
60 | * S EL3 (aka S PL1) | ||
61 | * NS EL1&0 stage 2 | ||
62 | * | ||
63 | - * for a total of 9 different mmu_idx. | ||
64 | + * for a total of 12 different mmu_idx. | ||
65 | * | ||
66 | * R profile CPUs have an MPU, but can use the same set of MMU indexes | ||
67 | * as A profile. They only need to distinguish NS EL0 and NS EL1 (and | ||
68 | @@ -XXX,XX +XXX,XX @@ typedef enum ARMMMUIdx { | ||
69 | /* | ||
70 | * A-profile. | ||
71 | */ | ||
72 | - ARMMMUIdx_E10_0 = 0 | ARM_MMU_IDX_A, | ||
73 | - ARMMMUIdx_E20_0 = 1 | ARM_MMU_IDX_A, | ||
74 | + ARMMMUIdx_E10_0 = 0 | ARM_MMU_IDX_A, | ||
75 | + ARMMMUIdx_E20_0 = 1 | ARM_MMU_IDX_A, | ||
76 | |||
77 | - ARMMMUIdx_E10_1 = 2 | ARM_MMU_IDX_A, | ||
78 | + ARMMMUIdx_E10_1 = 2 | ARM_MMU_IDX_A, | ||
79 | + ARMMMUIdx_E10_1_PAN = 3 | ARM_MMU_IDX_A, | ||
80 | |||
81 | - ARMMMUIdx_E2 = 3 | ARM_MMU_IDX_A, | ||
82 | - ARMMMUIdx_E20_2 = 4 | ARM_MMU_IDX_A, | ||
83 | + ARMMMUIdx_E2 = 4 | ARM_MMU_IDX_A, | ||
84 | + ARMMMUIdx_E20_2 = 5 | ARM_MMU_IDX_A, | ||
85 | + ARMMMUIdx_E20_2_PAN = 6 | ARM_MMU_IDX_A, | ||
86 | |||
87 | - ARMMMUIdx_SE10_0 = 5 | ARM_MMU_IDX_A, | ||
88 | - ARMMMUIdx_SE10_1 = 6 | ARM_MMU_IDX_A, | ||
89 | - ARMMMUIdx_SE3 = 7 | ARM_MMU_IDX_A, | ||
90 | + ARMMMUIdx_SE10_0 = 7 | ARM_MMU_IDX_A, | ||
91 | + ARMMMUIdx_SE10_1 = 8 | ARM_MMU_IDX_A, | ||
92 | + ARMMMUIdx_SE10_1_PAN = 9 | ARM_MMU_IDX_A, | ||
93 | + ARMMMUIdx_SE3 = 10 | ARM_MMU_IDX_A, | ||
94 | |||
95 | - ARMMMUIdx_Stage2 = 8 | ARM_MMU_IDX_A, | ||
96 | + ARMMMUIdx_Stage2 = 11 | ARM_MMU_IDX_A, | ||
97 | |||
98 | /* | ||
99 | * These are not allocated TLBs and are used only for AT system | ||
100 | @@ -XXX,XX +XXX,XX @@ typedef enum ARMMMUIdx { | ||
101 | */ | ||
102 | ARMMMUIdx_Stage1_E0 = 0 | ARM_MMU_IDX_NOTLB, | ||
103 | ARMMMUIdx_Stage1_E1 = 1 | ARM_MMU_IDX_NOTLB, | ||
104 | + ARMMMUIdx_Stage1_E1_PAN = 2 | ARM_MMU_IDX_NOTLB, | ||
105 | |||
106 | /* | ||
107 | * M-profile. | ||
108 | @@ -XXX,XX +XXX,XX @@ typedef enum ARMMMUIdxBit { | ||
109 | TO_CORE_BIT(E10_0), | ||
110 | TO_CORE_BIT(E20_0), | ||
111 | TO_CORE_BIT(E10_1), | ||
112 | + TO_CORE_BIT(E10_1_PAN), | ||
113 | TO_CORE_BIT(E2), | ||
114 | TO_CORE_BIT(E20_2), | ||
115 | + TO_CORE_BIT(E20_2_PAN), | ||
116 | TO_CORE_BIT(SE10_0), | ||
117 | TO_CORE_BIT(SE10_1), | ||
118 | + TO_CORE_BIT(SE10_1_PAN), | ||
119 | TO_CORE_BIT(SE3), | ||
120 | TO_CORE_BIT(Stage2), | ||
121 | |||
122 | diff --git a/target/arm/internals.h b/target/arm/internals.h | 142 | diff --git a/target/arm/internals.h b/target/arm/internals.h |
123 | index XXXXXXX..XXXXXXX 100644 | 143 | index XXXXXXX..XXXXXXX 100644 |
124 | --- a/target/arm/internals.h | 144 | --- a/target/arm/internals.h |
125 | +++ b/target/arm/internals.h | 145 | +++ b/target/arm/internals.h |
126 | @@ -XXX,XX +XXX,XX @@ static inline bool regime_has_2_ranges(ARMMMUIdx mmu_idx) | 146 | @@ -XXX,XX +XXX,XX @@ static inline uint64_t arm_mdcr_el2_eff(CPUARMState *env) |
127 | switch (mmu_idx) { | 147 | ((1 << (1 - 1)) | (1 << (2 - 1)) | \ |
128 | case ARMMMUIdx_Stage1_E0: | 148 | (1 << (4 - 1)) | (1 << (8 - 1)) | (1 << (16 - 1))) |
129 | case ARMMMUIdx_Stage1_E1: | 149 | |
130 | + case ARMMMUIdx_Stage1_E1_PAN: | 150 | +/* |
131 | case ARMMMUIdx_E10_0: | 151 | + * Return true if it is possible to take a fine-grained-trap to EL2. |
132 | case ARMMMUIdx_E10_1: | 152 | + */ |
133 | + case ARMMMUIdx_E10_1_PAN: | 153 | +static inline bool arm_fgt_active(CPUARMState *env, int el) |
134 | case ARMMMUIdx_E20_0: | 154 | +{ |
135 | case ARMMMUIdx_E20_2: | 155 | + /* |
136 | + case ARMMMUIdx_E20_2_PAN: | 156 | + * The Arm ARM only requires the "{E2H,TGE} != {1,1}" test for traps |
137 | case ARMMMUIdx_SE10_0: | 157 | + * that can affect EL0, but it is harmless to do the test also for |
138 | case ARMMMUIdx_SE10_1: | 158 | + * traps on registers that are only accessible at EL1 because if the test |
139 | + case ARMMMUIdx_SE10_1_PAN: | 159 | + * returns true then we can't be executing at EL1 anyway. |
140 | return true; | 160 | + * FGT traps only happen when EL2 is enabled and EL1 is AArch64; |
141 | default: | 161 | + * traps from AArch32 only happen for the EL0 is AArch32 case. |
142 | return false; | 162 | + */ |
143 | @@ -XXX,XX +XXX,XX @@ static inline bool regime_is_secure(CPUARMState *env, ARMMMUIdx mmu_idx) | 163 | + return cpu_isar_feature(aa64_fgt, env_archcpu(env)) && |
144 | switch (mmu_idx) { | 164 | + el < 2 && arm_is_el2_enabled(env) && |
145 | case ARMMMUIdx_E10_0: | 165 | + arm_el_is_aa64(env, 1) && |
146 | case ARMMMUIdx_E10_1: | 166 | + (arm_hcr_el2_eff(env) & (HCR_E2H | HCR_TGE)) != (HCR_E2H | HCR_TGE) && |
147 | + case ARMMMUIdx_E10_1_PAN: | 167 | + (!arm_feature(env, ARM_FEATURE_EL3) || (env->cp15.scr_el3 & SCR_FGTEN)); |
148 | case ARMMMUIdx_E20_0: | 168 | +} |
149 | case ARMMMUIdx_E20_2: | 169 | + |
150 | + case ARMMMUIdx_E20_2_PAN: | 170 | #endif |
151 | case ARMMMUIdx_Stage1_E0: | 171 | diff --git a/target/arm/translate.h b/target/arm/translate.h |
152 | case ARMMMUIdx_Stage1_E1: | 172 | index XXXXXXX..XXXXXXX 100644 |
153 | + case ARMMMUIdx_Stage1_E1_PAN: | 173 | --- a/target/arm/translate.h |
154 | case ARMMMUIdx_E2: | 174 | +++ b/target/arm/translate.h |
155 | case ARMMMUIdx_Stage2: | 175 | @@ -XXX,XX +XXX,XX @@ typedef struct DisasContext { |
156 | case ARMMMUIdx_MPrivNegPri: | 176 | bool is_nonstreaming; |
157 | @@ -XXX,XX +XXX,XX @@ static inline bool regime_is_secure(CPUARMState *env, ARMMMUIdx mmu_idx) | 177 | /* True if MVE insns are definitely not predicated by VPR or LTPSIZE */ |
158 | case ARMMMUIdx_SE3: | 178 | bool mve_no_pred; |
159 | case ARMMMUIdx_SE10_0: | 179 | + /* True if fine-grained traps are active */ |
160 | case ARMMMUIdx_SE10_1: | 180 | + bool fgt_active; |
161 | + case ARMMMUIdx_SE10_1_PAN: | 181 | /* |
162 | case ARMMMUIdx_MSPrivNegPri: | 182 | * >= 0, a copy of PSTATE.BTYPE, which will be 0 without v8.5-BTI. |
163 | case ARMMMUIdx_MSUserNegPri: | 183 | * < 0, set by the current instruction. |
164 | case ARMMMUIdx_MSPriv: | ||
165 | @@ -XXX,XX +XXX,XX @@ static inline bool arm_mmu_idx_is_stage1_of_2(ARMMMUIdx mmu_idx) | ||
166 | switch (mmu_idx) { | ||
167 | case ARMMMUIdx_Stage1_E0: | ||
168 | case ARMMMUIdx_Stage1_E1: | ||
169 | + case ARMMMUIdx_Stage1_E1_PAN: | ||
170 | return true; | ||
171 | default: | ||
172 | return false; | ||
173 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 184 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
174 | index XXXXXXX..XXXXXXX 100644 | 185 | index XXXXXXX..XXXXXXX 100644 |
175 | --- a/target/arm/helper.c | 186 | --- a/target/arm/helper.c |
176 | +++ b/target/arm/helper.c | 187 | +++ b/target/arm/helper.c |
177 | @@ -XXX,XX +XXX,XX @@ static void tlbiall_nsnh_write(CPUARMState *env, const ARMCPRegInfo *ri, | 188 | @@ -XXX,XX +XXX,XX @@ static CPUARMTBFlags rebuild_hflags_common(CPUARMState *env, int fp_el, |
178 | 189 | if (arm_singlestep_active(env)) { | |
179 | tlb_flush_by_mmuidx(cs, | 190 | DP_TBFLAG_ANY(flags, SS_ACTIVE, 1); |
180 | ARMMMUIdxBit_E10_1 | | 191 | } |
181 | + ARMMMUIdxBit_E10_1_PAN | | 192 | + |
182 | ARMMMUIdxBit_E10_0 | | 193 | return flags; |
183 | ARMMMUIdxBit_Stage2); | ||
184 | } | 194 | } |
185 | @@ -XXX,XX +XXX,XX @@ static void tlbiall_nsnh_is_write(CPUARMState *env, const ARMCPRegInfo *ri, | 195 | |
186 | 196 | @@ -XXX,XX +XXX,XX @@ static CPUARMTBFlags rebuild_hflags_a32(CPUARMState *env, int fp_el, | |
187 | tlb_flush_by_mmuidx_all_cpus_synced(cs, | 197 | DP_TBFLAG_A32(flags, HSTR_ACTIVE, 1); |
188 | ARMMMUIdxBit_E10_1 | | 198 | } |
189 | + ARMMMUIdxBit_E10_1_PAN | | 199 | |
190 | ARMMMUIdxBit_E10_0 | | 200 | + if (arm_fgt_active(env, el)) { |
191 | ARMMMUIdxBit_Stage2); | 201 | + DP_TBFLAG_ANY(flags, FGT_ACTIVE, 1); |
192 | } | 202 | + } |
193 | @@ -XXX,XX +XXX,XX @@ static int gt_phys_redir_timeridx(CPUARMState *env) | 203 | + |
194 | switch (arm_mmu_idx(env)) { | 204 | if (env->uncached_cpsr & CPSR_IL) { |
195 | case ARMMMUIdx_E20_0: | 205 | DP_TBFLAG_ANY(flags, PSTATE__IL, 1); |
196 | case ARMMMUIdx_E20_2: | 206 | } |
197 | + case ARMMMUIdx_E20_2_PAN: | 207 | @@ -XXX,XX +XXX,XX @@ static CPUARMTBFlags rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, |
198 | return GTIMER_HYP; | 208 | DP_TBFLAG_ANY(flags, PSTATE__IL, 1); |
199 | default: | 209 | } |
200 | return GTIMER_PHYS; | 210 | |
201 | @@ -XXX,XX +XXX,XX @@ static int gt_virt_redir_timeridx(CPUARMState *env) | 211 | + if (arm_fgt_active(env, el)) { |
202 | switch (arm_mmu_idx(env)) { | 212 | + DP_TBFLAG_ANY(flags, FGT_ACTIVE, 1); |
203 | case ARMMMUIdx_E20_0: | 213 | + } |
204 | case ARMMMUIdx_E20_2: | 214 | + |
205 | + case ARMMMUIdx_E20_2_PAN: | 215 | if (cpu_isar_feature(aa64_mte, env_archcpu(env))) { |
206 | return GTIMER_HYPVIRT; | ||
207 | default: | ||
208 | return GTIMER_VIRT; | ||
209 | @@ -XXX,XX +XXX,XX @@ static uint64_t do_ats_write(CPUARMState *env, uint64_t value, | ||
210 | format64 = arm_s1_regime_using_lpae_format(env, mmu_idx); | ||
211 | |||
212 | if (arm_feature(env, ARM_FEATURE_EL2)) { | ||
213 | - if (mmu_idx == ARMMMUIdx_E10_0 || mmu_idx == ARMMMUIdx_E10_1) { | ||
214 | + if (mmu_idx == ARMMMUIdx_E10_0 || | ||
215 | + mmu_idx == ARMMMUIdx_E10_1 || | ||
216 | + mmu_idx == ARMMMUIdx_E10_1_PAN) { | ||
217 | format64 |= env->cp15.hcr_el2 & (HCR_VM | HCR_DC); | ||
218 | } else { | ||
219 | format64 |= arm_current_el(env) == 2; | ||
220 | @@ -XXX,XX +XXX,XX @@ static void vmsa_tcr_ttbr_el2_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
221 | if (extract64(raw_read(env, ri) ^ value, 48, 16) && | ||
222 | (arm_hcr_el2_eff(env) & HCR_E2H)) { | ||
223 | tlb_flush_by_mmuidx(env_cpu(env), | ||
224 | - ARMMMUIdxBit_E20_2 | ARMMMUIdxBit_E20_0); | ||
225 | + ARMMMUIdxBit_E20_2 | | ||
226 | + ARMMMUIdxBit_E20_2_PAN | | ||
227 | + ARMMMUIdxBit_E20_0); | ||
228 | } | ||
229 | raw_write(env, ri, value); | ||
230 | } | ||
231 | @@ -XXX,XX +XXX,XX @@ static void vttbr_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
232 | if (raw_read(env, ri) != value) { | ||
233 | tlb_flush_by_mmuidx(cs, | ||
234 | ARMMMUIdxBit_E10_1 | | ||
235 | + ARMMMUIdxBit_E10_1_PAN | | ||
236 | ARMMMUIdxBit_E10_0 | | ||
237 | ARMMMUIdxBit_Stage2); | ||
238 | raw_write(env, ri, value); | ||
239 | @@ -XXX,XX +XXX,XX @@ static int vae1_tlbmask(CPUARMState *env) | ||
240 | { | ||
241 | /* Since we exclude secure first, we may read HCR_EL2 directly. */ | ||
242 | if (arm_is_secure_below_el3(env)) { | ||
243 | - return ARMMMUIdxBit_SE10_1 | ARMMMUIdxBit_SE10_0; | ||
244 | + return ARMMMUIdxBit_SE10_1 | | ||
245 | + ARMMMUIdxBit_SE10_1_PAN | | ||
246 | + ARMMMUIdxBit_SE10_0; | ||
247 | } else if ((env->cp15.hcr_el2 & (HCR_E2H | HCR_TGE)) | ||
248 | == (HCR_E2H | HCR_TGE)) { | ||
249 | - return ARMMMUIdxBit_E20_2 | ARMMMUIdxBit_E20_0; | ||
250 | + return ARMMMUIdxBit_E20_2 | | ||
251 | + ARMMMUIdxBit_E20_2_PAN | | ||
252 | + ARMMMUIdxBit_E20_0; | ||
253 | } else { | ||
254 | - return ARMMMUIdxBit_E10_1 | ARMMMUIdxBit_E10_0; | ||
255 | + return ARMMMUIdxBit_E10_1 | | ||
256 | + ARMMMUIdxBit_E10_1_PAN | | ||
257 | + ARMMMUIdxBit_E10_0; | ||
258 | } | ||
259 | } | ||
260 | |||
261 | @@ -XXX,XX +XXX,XX @@ static int alle1_tlbmask(CPUARMState *env) | ||
262 | * stage 1 translations. | ||
263 | */ | ||
264 | if (arm_is_secure_below_el3(env)) { | ||
265 | - return ARMMMUIdxBit_SE10_1 | ARMMMUIdxBit_SE10_0; | ||
266 | + return ARMMMUIdxBit_SE10_1 | | ||
267 | + ARMMMUIdxBit_SE10_1_PAN | | ||
268 | + ARMMMUIdxBit_SE10_0; | ||
269 | } else if (arm_feature(env, ARM_FEATURE_EL2)) { | ||
270 | - return ARMMMUIdxBit_E10_1 | ARMMMUIdxBit_E10_0 | ARMMMUIdxBit_Stage2; | ||
271 | + return ARMMMUIdxBit_E10_1 | | ||
272 | + ARMMMUIdxBit_E10_1_PAN | | ||
273 | + ARMMMUIdxBit_E10_0 | | ||
274 | + ARMMMUIdxBit_Stage2; | ||
275 | } else { | ||
276 | - return ARMMMUIdxBit_E10_1 | ARMMMUIdxBit_E10_0; | ||
277 | + return ARMMMUIdxBit_E10_1 | | ||
278 | + ARMMMUIdxBit_E10_1_PAN | | ||
279 | + ARMMMUIdxBit_E10_0; | ||
280 | } | ||
281 | } | ||
282 | |||
283 | static int e2_tlbmask(CPUARMState *env) | ||
284 | { | ||
285 | /* TODO: ARMv8.4-SecEL2 */ | ||
286 | - return ARMMMUIdxBit_E20_0 | ARMMMUIdxBit_E20_2 | ARMMMUIdxBit_E2; | ||
287 | + return ARMMMUIdxBit_E20_0 | | ||
288 | + ARMMMUIdxBit_E20_2 | | ||
289 | + ARMMMUIdxBit_E20_2_PAN | | ||
290 | + ARMMMUIdxBit_E2; | ||
291 | } | ||
292 | |||
293 | static void tlbi_aa64_alle1_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
294 | @@ -XXX,XX +XXX,XX @@ static uint32_t regime_el(CPUARMState *env, ARMMMUIdx mmu_idx) | ||
295 | switch (mmu_idx) { | ||
296 | case ARMMMUIdx_E20_0: | ||
297 | case ARMMMUIdx_E20_2: | ||
298 | + case ARMMMUIdx_E20_2_PAN: | ||
299 | case ARMMMUIdx_Stage2: | ||
300 | case ARMMMUIdx_E2: | ||
301 | return 2; | ||
302 | @@ -XXX,XX +XXX,XX @@ static uint32_t regime_el(CPUARMState *env, ARMMMUIdx mmu_idx) | ||
303 | case ARMMMUIdx_SE10_0: | ||
304 | return arm_el_is_aa64(env, 3) ? 1 : 3; | ||
305 | case ARMMMUIdx_SE10_1: | ||
306 | + case ARMMMUIdx_SE10_1_PAN: | ||
307 | case ARMMMUIdx_Stage1_E0: | ||
308 | case ARMMMUIdx_Stage1_E1: | ||
309 | + case ARMMMUIdx_Stage1_E1_PAN: | ||
310 | case ARMMMUIdx_E10_0: | ||
311 | case ARMMMUIdx_E10_1: | ||
312 | + case ARMMMUIdx_E10_1_PAN: | ||
313 | case ARMMMUIdx_MPrivNegPri: | ||
314 | case ARMMMUIdx_MUserNegPri: | ||
315 | case ARMMMUIdx_MPriv: | ||
316 | @@ -XXX,XX +XXX,XX @@ static inline ARMMMUIdx stage_1_mmu_idx(ARMMMUIdx mmu_idx) | ||
317 | return ARMMMUIdx_Stage1_E0; | ||
318 | case ARMMMUIdx_E10_1: | ||
319 | return ARMMMUIdx_Stage1_E1; | ||
320 | + case ARMMMUIdx_E10_1_PAN: | ||
321 | + return ARMMMUIdx_Stage1_E1_PAN; | ||
322 | default: | ||
323 | return mmu_idx; | ||
324 | } | ||
325 | @@ -XXX,XX +XXX,XX @@ static inline bool regime_is_user(CPUARMState *env, ARMMMUIdx mmu_idx) | ||
326 | return false; | ||
327 | case ARMMMUIdx_E10_0: | ||
328 | case ARMMMUIdx_E10_1: | ||
329 | + case ARMMMUIdx_E10_1_PAN: | ||
330 | g_assert_not_reached(); | ||
331 | } | ||
332 | } | ||
333 | @@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
334 | target_ulong *page_size, | ||
335 | ARMMMUFaultInfo *fi, ARMCacheAttrs *cacheattrs) | ||
336 | { | ||
337 | - if (mmu_idx == ARMMMUIdx_E10_0 || mmu_idx == ARMMMUIdx_E10_1) { | ||
338 | + if (mmu_idx == ARMMMUIdx_E10_0 || | ||
339 | + mmu_idx == ARMMMUIdx_E10_1 || | ||
340 | + mmu_idx == ARMMMUIdx_E10_1_PAN) { | ||
341 | /* Call ourselves recursively to do the stage 1 and then stage 2 | ||
342 | * translations. | ||
343 | */ | ||
344 | @@ -XXX,XX +XXX,XX @@ int arm_mmu_idx_to_el(ARMMMUIdx mmu_idx) | ||
345 | case ARMMMUIdx_SE10_0: | ||
346 | return 0; | ||
347 | case ARMMMUIdx_E10_1: | ||
348 | + case ARMMMUIdx_E10_1_PAN: | ||
349 | case ARMMMUIdx_SE10_1: | ||
350 | + case ARMMMUIdx_SE10_1_PAN: | ||
351 | return 1; | ||
352 | case ARMMMUIdx_E2: | ||
353 | case ARMMMUIdx_E20_2: | ||
354 | + case ARMMMUIdx_E20_2_PAN: | ||
355 | return 2; | ||
356 | case ARMMMUIdx_SE3: | ||
357 | return 3; | ||
358 | @@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, | ||
359 | /* TODO: ARMv8.2-UAO */ | ||
360 | switch (mmu_idx) { | ||
361 | case ARMMMUIdx_E10_1: | ||
362 | + case ARMMMUIdx_E10_1_PAN: | ||
363 | case ARMMMUIdx_SE10_1: | ||
364 | + case ARMMMUIdx_SE10_1_PAN: | ||
365 | /* TODO: ARMv8.3-NV */ | ||
366 | flags = FIELD_DP32(flags, TBFLAG_A64, UNPRIV, 1); | ||
367 | break; | ||
368 | case ARMMMUIdx_E20_2: | ||
369 | + case ARMMMUIdx_E20_2_PAN: | ||
370 | /* TODO: ARMv8.4-SecEL2 */ | ||
371 | /* | 216 | /* |
372 | * Note that E20_2 is gated by HCR_EL2.E2H == 1, but E20_0 is | 217 | * Set MTE_ACTIVE if any access may be Checked, and leave clear |
218 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c | ||
219 | index XXXXXXX..XXXXXXX 100644 | ||
220 | --- a/target/arm/op_helper.c | ||
221 | +++ b/target/arm/op_helper.c | ||
222 | @@ -XXX,XX +XXX,XX @@ const void *HELPER(access_check_cp_reg)(CPUARMState *env, uint32_t key, | ||
223 | } | ||
224 | } | ||
225 | |||
226 | + /* | ||
227 | + * Fine-grained traps also are lower priority than undef-to-EL1, | ||
228 | + * higher priority than trap-to-EL3, and we don't care about priority | ||
229 | + * order with other EL2 traps because the syndrome value is the same. | ||
230 | + */ | ||
231 | + if (arm_fgt_active(env, arm_current_el(env))) { | ||
232 | + uint64_t trapword = 0; | ||
233 | + unsigned int idx = FIELD_EX32(ri->fgt, FGT, IDX); | ||
234 | + unsigned int bitpos = FIELD_EX32(ri->fgt, FGT, BITPOS); | ||
235 | + bool rev = FIELD_EX32(ri->fgt, FGT, REV); | ||
236 | + bool trapbit; | ||
237 | + | ||
238 | + if (ri->fgt & FGT_EXEC) { | ||
239 | + assert(idx < ARRAY_SIZE(env->cp15.fgt_exec)); | ||
240 | + trapword = env->cp15.fgt_exec[idx]; | ||
241 | + } else if (isread && (ri->fgt & FGT_R)) { | ||
242 | + assert(idx < ARRAY_SIZE(env->cp15.fgt_read)); | ||
243 | + trapword = env->cp15.fgt_read[idx]; | ||
244 | + } else if (!isread && (ri->fgt & FGT_W)) { | ||
245 | + assert(idx < ARRAY_SIZE(env->cp15.fgt_write)); | ||
246 | + trapword = env->cp15.fgt_write[idx]; | ||
247 | + } | ||
248 | + | ||
249 | + trapbit = extract64(trapword, bitpos, 1); | ||
250 | + if (trapbit != rev) { | ||
251 | + res = CP_ACCESS_TRAP_EL2; | ||
252 | + goto fail; | ||
253 | + } | ||
254 | + } | ||
255 | + | ||
256 | if (likely(res == CP_ACCESS_OK)) { | ||
257 | return ri; | ||
258 | } | ||
373 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 259 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
374 | index XXXXXXX..XXXXXXX 100644 | 260 | index XXXXXXX..XXXXXXX 100644 |
375 | --- a/target/arm/translate-a64.c | 261 | --- a/target/arm/translate-a64.c |
376 | +++ b/target/arm/translate-a64.c | 262 | +++ b/target/arm/translate-a64.c |
377 | @@ -XXX,XX +XXX,XX @@ static int get_a64_user_mem_index(DisasContext *s) | 263 | @@ -XXX,XX +XXX,XX @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread, |
264 | return; | ||
265 | } | ||
266 | |||
267 | - if (ri->accessfn) { | ||
268 | + if (ri->accessfn || (ri->fgt && s->fgt_active)) { | ||
269 | /* Emit code to perform further access permissions checks at | ||
270 | * runtime; this may result in an exception. | ||
378 | */ | 271 | */ |
379 | switch (useridx) { | 272 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, |
380 | case ARMMMUIdx_E10_1: | 273 | dc->fp_excp_el = EX_TBFLAG_ANY(tb_flags, FPEXC_EL); |
381 | + case ARMMMUIdx_E10_1_PAN: | 274 | dc->align_mem = EX_TBFLAG_ANY(tb_flags, ALIGN_MEM); |
382 | useridx = ARMMMUIdx_E10_0; | 275 | dc->pstate_il = EX_TBFLAG_ANY(tb_flags, PSTATE__IL); |
383 | break; | 276 | + dc->fgt_active = EX_TBFLAG_ANY(tb_flags, FGT_ACTIVE); |
384 | case ARMMMUIdx_E20_2: | 277 | dc->sve_excp_el = EX_TBFLAG_A64(tb_flags, SVEEXC_EL); |
385 | + case ARMMMUIdx_E20_2_PAN: | 278 | dc->sme_excp_el = EX_TBFLAG_A64(tb_flags, SMEEXC_EL); |
386 | useridx = ARMMMUIdx_E20_0; | 279 | dc->vl = (EX_TBFLAG_A64(tb_flags, VL) + 1) * 16; |
387 | break; | ||
388 | case ARMMMUIdx_SE10_1: | ||
389 | + case ARMMMUIdx_SE10_1_PAN: | ||
390 | useridx = ARMMMUIdx_SE10_0; | ||
391 | break; | ||
392 | default: | ||
393 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 280 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
394 | index XXXXXXX..XXXXXXX 100644 | 281 | index XXXXXXX..XXXXXXX 100644 |
395 | --- a/target/arm/translate.c | 282 | --- a/target/arm/translate.c |
396 | +++ b/target/arm/translate.c | 283 | +++ b/target/arm/translate.c |
397 | @@ -XXX,XX +XXX,XX @@ static inline int get_a32_user_mem_index(DisasContext *s) | 284 | @@ -XXX,XX +XXX,XX @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, |
398 | case ARMMMUIdx_E2: /* this one is UNPREDICTABLE */ | 285 | } |
399 | case ARMMMUIdx_E10_0: | 286 | |
400 | case ARMMMUIdx_E10_1: | 287 | if ((s->hstr_active && s->current_el == 0) || ri->accessfn || |
401 | + case ARMMMUIdx_E10_1_PAN: | 288 | + (ri->fgt && s->fgt_active) || |
402 | return arm_to_core_mmu_idx(ARMMMUIdx_E10_0); | 289 | (arm_dc_feature(s, ARM_FEATURE_XSCALE) && cpnum < 14)) { |
403 | case ARMMMUIdx_SE3: | 290 | /* |
404 | case ARMMMUIdx_SE10_0: | 291 | * Emit code to perform further access permissions checks at |
405 | case ARMMMUIdx_SE10_1: | 292 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) |
406 | + case ARMMMUIdx_SE10_1_PAN: | 293 | dc->fp_excp_el = EX_TBFLAG_ANY(tb_flags, FPEXC_EL); |
407 | return arm_to_core_mmu_idx(ARMMMUIdx_SE10_0); | 294 | dc->align_mem = EX_TBFLAG_ANY(tb_flags, ALIGN_MEM); |
408 | case ARMMMUIdx_MUser: | 295 | dc->pstate_il = EX_TBFLAG_ANY(tb_flags, PSTATE__IL); |
409 | case ARMMMUIdx_MPriv: | 296 | + dc->fgt_active = EX_TBFLAG_ANY(tb_flags, FGT_ACTIVE); |
297 | |||
298 | if (arm_feature(env, ARM_FEATURE_M)) { | ||
299 | dc->vfp_enabled = 1; | ||
410 | -- | 300 | -- |
411 | 2.20.1 | 301 | 2.34.1 |
412 | |||
413 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | Mark up the sysreg definitions for the registers trapped |
---|---|---|---|
2 | by HFGRTR/HFGWTR bits 0..11. | ||
2 | 3 | ||
3 | With the exception of the ignore_memory_transaction_failures | 4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | flag set for the raspi2, both machine_class_init() methods | 5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
5 | are now identical. Merge them to keep a unique method. | 6 | Tested-by: Fuad Tabba <tabba@google.com> |
7 | Message-id: 20230130182459.3309057-11-peter.maydell@linaro.org | ||
8 | Message-id: 20230127175507.2895013-11-peter.maydell@linaro.org | ||
9 | --- | ||
10 | target/arm/cpregs.h | 14 ++++++++++++++ | ||
11 | target/arm/helper.c | 17 +++++++++++++++++ | ||
12 | 2 files changed, 31 insertions(+) | ||
6 | 13 | ||
7 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 14 | diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h |
8 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | ||
9 | Message-id: 20200208165645.15657-13-f4bug@amsat.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | hw/arm/raspi.c | 31 ++++++------------------------- | ||
13 | 1 file changed, 6 insertions(+), 25 deletions(-) | ||
14 | |||
15 | diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/raspi.c | 16 | --- a/target/arm/cpregs.h |
18 | +++ b/hw/arm/raspi.c | 17 | +++ b/target/arm/cpregs.h |
19 | @@ -XXX,XX +XXX,XX @@ static void raspi_machine_init(MachineState *machine) | 18 | @@ -XXX,XX +XXX,XX @@ typedef enum FGTBit { |
20 | setup_boot(machine, version, machine->ram_size - vcram_size); | 19 | FGT_HDFGRTR = FGT_RW | (FGTREG_HDFGRTR << R_FGT_IDX_SHIFT), |
21 | } | 20 | FGT_HDFGWTR = FGT_W | (FGTREG_HDFGWTR << R_FGT_IDX_SHIFT), |
22 | 21 | FGT_HFGITR = FGT_EXEC | (FGTREG_HFGITR << R_FGT_IDX_SHIFT), | |
23 | -static void raspi2_machine_class_init(ObjectClass *oc, void *data) | 22 | + |
24 | +static void raspi_machine_class_init(ObjectClass *oc, void *data) | 23 | + /* Trap bits in HFGRTR_EL2 / HFGWTR_EL2, starting from bit 0. */ |
25 | { | 24 | + DO_BIT(HFGRTR, AFSR0_EL1), |
26 | MachineClass *mc = MACHINE_CLASS(oc); | 25 | + DO_BIT(HFGRTR, AFSR1_EL1), |
27 | RaspiMachineClass *rmc = RASPI_MACHINE_CLASS(oc); | 26 | + DO_BIT(HFGRTR, AIDR_EL1), |
28 | @@ -XXX,XX +XXX,XX @@ static void raspi2_machine_class_init(ObjectClass *oc, void *data) | 27 | + DO_BIT(HFGRTR, AMAIR_EL1), |
29 | mc->min_cpus = BCM283X_NCPUS; | 28 | + DO_BIT(HFGRTR, APDAKEY), |
30 | mc->default_cpus = BCM283X_NCPUS; | 29 | + DO_BIT(HFGRTR, APDBKEY), |
31 | mc->default_ram_size = board_ram_size(board_rev); | 30 | + DO_BIT(HFGRTR, APGAKEY), |
32 | - mc->ignore_memory_transaction_failures = true; | 31 | + DO_BIT(HFGRTR, APIAKEY), |
33 | + if (board_version(board_rev) == 2) { | 32 | + DO_BIT(HFGRTR, APIBKEY), |
34 | + mc->ignore_memory_transaction_failures = true; | 33 | + DO_BIT(HFGRTR, CCSIDR_EL1), |
35 | + } | 34 | + DO_BIT(HFGRTR, CLIDR_EL1), |
35 | + DO_BIT(HFGRTR, CONTEXTIDR_EL1), | ||
36 | } FGTBit; | ||
37 | |||
38 | #undef DO_BIT | ||
39 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
40 | index XXXXXXX..XXXXXXX 100644 | ||
41 | --- a/target/arm/helper.c | ||
42 | +++ b/target/arm/helper.c | ||
43 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo cp_reginfo[] = { | ||
44 | { .name = "CONTEXTIDR_EL1", .state = ARM_CP_STATE_BOTH, | ||
45 | .opc0 = 3, .opc1 = 0, .crn = 13, .crm = 0, .opc2 = 1, | ||
46 | .access = PL1_RW, .accessfn = access_tvm_trvm, | ||
47 | + .fgt = FGT_CONTEXTIDR_EL1, | ||
48 | .secure = ARM_CP_SECSTATE_NS, | ||
49 | .fieldoffset = offsetof(CPUARMState, cp15.contextidr_el[1]), | ||
50 | .resetvalue = 0, .writefn = contextidr_write, .raw_writefn = raw_write, }, | ||
51 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = { | ||
52 | .opc0 = 3, .crn = 0, .crm = 0, .opc1 = 1, .opc2 = 0, | ||
53 | .access = PL1_R, | ||
54 | .accessfn = access_tid4, | ||
55 | + .fgt = FGT_CCSIDR_EL1, | ||
56 | .readfn = ccsidr_read, .type = ARM_CP_NO_RAW }, | ||
57 | { .name = "CSSELR", .state = ARM_CP_STATE_BOTH, | ||
58 | .opc0 = 3, .crn = 0, .crm = 0, .opc1 = 2, .opc2 = 0, | ||
59 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = { | ||
60 | .opc0 = 3, .opc1 = 1, .crn = 0, .crm = 0, .opc2 = 7, | ||
61 | .access = PL1_R, .type = ARM_CP_CONST, | ||
62 | .accessfn = access_aa64_tid1, | ||
63 | + .fgt = FGT_AIDR_EL1, | ||
64 | .resetvalue = 0 }, | ||
65 | /* | ||
66 | * Auxiliary fault status registers: these also are IMPDEF, and we | ||
67 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = { | ||
68 | { .name = "AFSR0_EL1", .state = ARM_CP_STATE_BOTH, | ||
69 | .opc0 = 3, .opc1 = 0, .crn = 5, .crm = 1, .opc2 = 0, | ||
70 | .access = PL1_RW, .accessfn = access_tvm_trvm, | ||
71 | + .fgt = FGT_AFSR0_EL1, | ||
72 | .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
73 | { .name = "AFSR1_EL1", .state = ARM_CP_STATE_BOTH, | ||
74 | .opc0 = 3, .opc1 = 0, .crn = 5, .crm = 1, .opc2 = 1, | ||
75 | .access = PL1_RW, .accessfn = access_tvm_trvm, | ||
76 | + .fgt = FGT_AFSR1_EL1, | ||
77 | .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
78 | /* | ||
79 | * MAIR can just read-as-written because we don't implement caches | ||
80 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo lpae_cp_reginfo[] = { | ||
81 | { .name = "AMAIR0", .state = ARM_CP_STATE_BOTH, | ||
82 | .opc0 = 3, .crn = 10, .crm = 3, .opc1 = 0, .opc2 = 0, | ||
83 | .access = PL1_RW, .accessfn = access_tvm_trvm, | ||
84 | + .fgt = FGT_AMAIR_EL1, | ||
85 | .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
86 | /* AMAIR1 is mapped to AMAIR_EL1[63:32] */ | ||
87 | { .name = "AMAIR1", .cp = 15, .crn = 10, .crm = 3, .opc1 = 0, .opc2 = 1, | ||
88 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo pauth_reginfo[] = { | ||
89 | { .name = "APDAKEYLO_EL1", .state = ARM_CP_STATE_AA64, | ||
90 | .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 2, .opc2 = 0, | ||
91 | .access = PL1_RW, .accessfn = access_pauth, | ||
92 | + .fgt = FGT_APDAKEY, | ||
93 | .fieldoffset = offsetof(CPUARMState, keys.apda.lo) }, | ||
94 | { .name = "APDAKEYHI_EL1", .state = ARM_CP_STATE_AA64, | ||
95 | .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 2, .opc2 = 1, | ||
96 | .access = PL1_RW, .accessfn = access_pauth, | ||
97 | + .fgt = FGT_APDAKEY, | ||
98 | .fieldoffset = offsetof(CPUARMState, keys.apda.hi) }, | ||
99 | { .name = "APDBKEYLO_EL1", .state = ARM_CP_STATE_AA64, | ||
100 | .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 2, .opc2 = 2, | ||
101 | .access = PL1_RW, .accessfn = access_pauth, | ||
102 | + .fgt = FGT_APDBKEY, | ||
103 | .fieldoffset = offsetof(CPUARMState, keys.apdb.lo) }, | ||
104 | { .name = "APDBKEYHI_EL1", .state = ARM_CP_STATE_AA64, | ||
105 | .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 2, .opc2 = 3, | ||
106 | .access = PL1_RW, .accessfn = access_pauth, | ||
107 | + .fgt = FGT_APDBKEY, | ||
108 | .fieldoffset = offsetof(CPUARMState, keys.apdb.hi) }, | ||
109 | { .name = "APGAKEYLO_EL1", .state = ARM_CP_STATE_AA64, | ||
110 | .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 3, .opc2 = 0, | ||
111 | .access = PL1_RW, .accessfn = access_pauth, | ||
112 | + .fgt = FGT_APGAKEY, | ||
113 | .fieldoffset = offsetof(CPUARMState, keys.apga.lo) }, | ||
114 | { .name = "APGAKEYHI_EL1", .state = ARM_CP_STATE_AA64, | ||
115 | .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 3, .opc2 = 1, | ||
116 | .access = PL1_RW, .accessfn = access_pauth, | ||
117 | + .fgt = FGT_APGAKEY, | ||
118 | .fieldoffset = offsetof(CPUARMState, keys.apga.hi) }, | ||
119 | { .name = "APIAKEYLO_EL1", .state = ARM_CP_STATE_AA64, | ||
120 | .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 1, .opc2 = 0, | ||
121 | .access = PL1_RW, .accessfn = access_pauth, | ||
122 | + .fgt = FGT_APIAKEY, | ||
123 | .fieldoffset = offsetof(CPUARMState, keys.apia.lo) }, | ||
124 | { .name = "APIAKEYHI_EL1", .state = ARM_CP_STATE_AA64, | ||
125 | .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 1, .opc2 = 1, | ||
126 | .access = PL1_RW, .accessfn = access_pauth, | ||
127 | + .fgt = FGT_APIAKEY, | ||
128 | .fieldoffset = offsetof(CPUARMState, keys.apia.hi) }, | ||
129 | { .name = "APIBKEYLO_EL1", .state = ARM_CP_STATE_AA64, | ||
130 | .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 1, .opc2 = 2, | ||
131 | .access = PL1_RW, .accessfn = access_pauth, | ||
132 | + .fgt = FGT_APIBKEY, | ||
133 | .fieldoffset = offsetof(CPUARMState, keys.apib.lo) }, | ||
134 | { .name = "APIBKEYHI_EL1", .state = ARM_CP_STATE_AA64, | ||
135 | .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 1, .opc2 = 3, | ||
136 | .access = PL1_RW, .accessfn = access_pauth, | ||
137 | + .fgt = FGT_APIBKEY, | ||
138 | .fieldoffset = offsetof(CPUARMState, keys.apib.hi) }, | ||
36 | }; | 139 | }; |
37 | 140 | ||
38 | -#ifdef TARGET_AARCH64 | 141 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) |
39 | -static void raspi3_machine_class_init(ObjectClass *oc, void *data) | 142 | .opc0 = 3, .crn = 0, .crm = 0, .opc1 = 1, .opc2 = 1, |
40 | -{ | 143 | .access = PL1_R, .type = ARM_CP_CONST, |
41 | - MachineClass *mc = MACHINE_CLASS(oc); | 144 | .accessfn = access_tid4, |
42 | - RaspiMachineClass *rmc = RASPI_MACHINE_CLASS(oc); | 145 | + .fgt = FGT_CLIDR_EL1, |
43 | - uint32_t board_rev = (uint32_t)(uintptr_t)data; | 146 | .resetvalue = cpu->clidr |
44 | - | 147 | }; |
45 | - rmc->board_rev = board_rev; | 148 | define_one_arm_cp_reg(cpu, &clidr); |
46 | - mc->desc = g_strdup_printf("Raspberry Pi %s", board_type(board_rev)); | ||
47 | - mc->init = raspi_machine_init; | ||
48 | - mc->block_default_type = IF_SD; | ||
49 | - mc->no_parallel = 1; | ||
50 | - mc->no_floppy = 1; | ||
51 | - mc->no_cdrom = 1; | ||
52 | - mc->max_cpus = BCM283X_NCPUS; | ||
53 | - mc->min_cpus = BCM283X_NCPUS; | ||
54 | - mc->default_cpus = BCM283X_NCPUS; | ||
55 | - mc->default_ram_size = board_ram_size(board_rev); | ||
56 | -} | ||
57 | -#endif | ||
58 | - | ||
59 | static const TypeInfo raspi_machine_types[] = { | ||
60 | { | ||
61 | .name = MACHINE_TYPE_NAME("raspi2"), | ||
62 | .parent = TYPE_RASPI_MACHINE, | ||
63 | - .class_init = raspi2_machine_class_init, | ||
64 | + .class_init = raspi_machine_class_init, | ||
65 | .class_data = (void *)0xa21041, | ||
66 | #ifdef TARGET_AARCH64 | ||
67 | }, { | ||
68 | .name = MACHINE_TYPE_NAME("raspi3"), | ||
69 | .parent = TYPE_RASPI_MACHINE, | ||
70 | - .class_init = raspi3_machine_class_init, | ||
71 | + .class_init = raspi_machine_class_init, | ||
72 | .class_data = (void *)0xa02082, | ||
73 | #endif | ||
74 | }, { | ||
75 | -- | 149 | -- |
76 | 2.20.1 | 150 | 2.34.1 |
77 | |||
78 | diff view generated by jsdifflib |
1 | From: Roman Kapl <rka@sysgo.com> | 1 | Mark up the sysreg definitions for the registers trapped |
---|---|---|---|
2 | by HFGRTR/HFGWTR bits 12..23. | ||
2 | 3 | ||
3 | Uses the i.MX2 rudimentary watchdog driver. | ||
4 | |||
5 | Signed-off-by: Roman Kapl <rka@sysgo.com> | ||
6 | Message-id: 20200207095529.11309-1-rka@sysgo.com | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | [PMM: removed accidental duplicate #include line] | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Tested-by: Fuad Tabba <tabba@google.com> | ||
7 | Message-id: 20230130182459.3309057-12-peter.maydell@linaro.org | ||
8 | Message-id: 20230127175507.2895013-12-peter.maydell@linaro.org | ||
10 | --- | 9 | --- |
11 | include/hw/arm/fsl-imx6.h | 3 +++ | 10 | target/arm/cpregs.h | 12 ++++++++++++ |
12 | hw/arm/fsl-imx6.c | 21 +++++++++++++++++++++ | 11 | target/arm/helper.c | 12 ++++++++++++ |
13 | 2 files changed, 24 insertions(+) | 12 | 2 files changed, 24 insertions(+) |
14 | 13 | ||
15 | diff --git a/include/hw/arm/fsl-imx6.h b/include/hw/arm/fsl-imx6.h | 14 | diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h |
16 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/include/hw/arm/fsl-imx6.h | 16 | --- a/target/arm/cpregs.h |
18 | +++ b/include/hw/arm/fsl-imx6.h | 17 | +++ b/target/arm/cpregs.h |
19 | @@ -XXX,XX +XXX,XX @@ | 18 | @@ -XXX,XX +XXX,XX @@ typedef enum FGTBit { |
20 | #include "hw/cpu/a9mpcore.h" | 19 | DO_BIT(HFGRTR, CCSIDR_EL1), |
21 | #include "hw/misc/imx6_ccm.h" | 20 | DO_BIT(HFGRTR, CLIDR_EL1), |
22 | #include "hw/misc/imx6_src.h" | 21 | DO_BIT(HFGRTR, CONTEXTIDR_EL1), |
23 | +#include "hw/misc/imx2_wdt.h" | 22 | + DO_BIT(HFGRTR, CPACR_EL1), |
24 | #include "hw/char/imx_serial.h" | 23 | + DO_BIT(HFGRTR, CSSELR_EL1), |
25 | #include "hw/timer/imx_gpt.h" | 24 | + DO_BIT(HFGRTR, CTR_EL0), |
26 | #include "hw/timer/imx_epit.h" | 25 | + DO_BIT(HFGRTR, DCZID_EL0), |
27 | @@ -XXX,XX +XXX,XX @@ | 26 | + DO_BIT(HFGRTR, ESR_EL1), |
28 | #define FSL_IMX6_NUM_GPIOS 7 | 27 | + DO_BIT(HFGRTR, FAR_EL1), |
29 | #define FSL_IMX6_NUM_ESDHCS 4 | 28 | + DO_BIT(HFGRTR, ISR_EL1), |
30 | #define FSL_IMX6_NUM_ECSPIS 5 | 29 | + DO_BIT(HFGRTR, LORC_EL1), |
31 | +#define FSL_IMX6_NUM_WDTS 2 | 30 | + DO_BIT(HFGRTR, LOREA_EL1), |
32 | 31 | + DO_BIT(HFGRTR, LORID_EL1), | |
33 | typedef struct FslIMX6State { | 32 | + DO_BIT(HFGRTR, LORN_EL1), |
34 | /*< private >*/ | 33 | + DO_BIT(HFGRTR, LORSA_EL1), |
35 | @@ -XXX,XX +XXX,XX @@ typedef struct FslIMX6State { | 34 | } FGTBit; |
36 | IMXGPIOState gpio[FSL_IMX6_NUM_GPIOS]; | 35 | |
37 | SDHCIState esdhc[FSL_IMX6_NUM_ESDHCS]; | 36 | #undef DO_BIT |
38 | IMXSPIState spi[FSL_IMX6_NUM_ECSPIS]; | 37 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
39 | + IMX2WdtState wdt[FSL_IMX6_NUM_WDTS]; | ||
40 | IMXFECState eth; | ||
41 | MemoryRegion rom; | ||
42 | MemoryRegion caam; | ||
43 | diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c | ||
44 | index XXXXXXX..XXXXXXX 100644 | 38 | index XXXXXXX..XXXXXXX 100644 |
45 | --- a/hw/arm/fsl-imx6.c | 39 | --- a/target/arm/helper.c |
46 | +++ b/hw/arm/fsl-imx6.c | 40 | +++ b/target/arm/helper.c |
47 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6_init(Object *obj) | 41 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v6_cp_reginfo[] = { |
48 | sysbus_init_child_obj(obj, name, &s->spi[i], sizeof(s->spi[i]), | 42 | .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0, }, |
49 | TYPE_IMX_SPI); | 43 | { .name = "CPACR", .state = ARM_CP_STATE_BOTH, .opc0 = 3, |
50 | } | 44 | .crn = 1, .crm = 0, .opc1 = 0, .opc2 = 2, .accessfn = cpacr_access, |
51 | + for (i = 0; i < FSL_IMX6_NUM_WDTS; i++) { | 45 | + .fgt = FGT_CPACR_EL1, |
52 | + snprintf(name, NAME_SIZE, "wdt%d", i); | 46 | .access = PL1_RW, .fieldoffset = offsetof(CPUARMState, cp15.cpacr_el1), |
53 | + sysbus_init_child_obj(obj, name, &s->wdt[i], sizeof(s->wdt[i]), | 47 | .resetfn = cpacr_reset, .writefn = cpacr_write, .readfn = cpacr_read }, |
54 | + TYPE_IMX2_WDT); | 48 | }; |
55 | + } | 49 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = { |
56 | + | 50 | .opc0 = 3, .crn = 0, .crm = 0, .opc1 = 2, .opc2 = 0, |
57 | 51 | .access = PL1_RW, | |
58 | sysbus_init_child_obj(obj, "eth", &s->eth, sizeof(s->eth), TYPE_IMX_ENET); | 52 | .accessfn = access_tid4, |
59 | } | 53 | + .fgt = FGT_CSSELR_EL1, |
60 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) | 54 | .writefn = csselr_write, .resetvalue = 0, |
61 | qdev_get_gpio_in(DEVICE(&s->a9mpcore), | 55 | .bank_fieldoffsets = { offsetof(CPUARMState, cp15.csselr_s), |
62 | FSL_IMX6_ENET_MAC_1588_IRQ)); | 56 | offsetof(CPUARMState, cp15.csselr_ns) } }, |
63 | 57 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = { | |
64 | + /* | 58 | .resetfn = arm_cp_reset_ignore }, |
65 | + * Watchdog | 59 | { .name = "ISR_EL1", .state = ARM_CP_STATE_BOTH, |
66 | + */ | 60 | .opc0 = 3, .opc1 = 0, .crn = 12, .crm = 1, .opc2 = 0, |
67 | + for (i = 0; i < FSL_IMX6_NUM_WDTS; i++) { | 61 | + .fgt = FGT_ISR_EL1, |
68 | + static const hwaddr FSL_IMX6_WDOGn_ADDR[FSL_IMX6_NUM_WDTS] = { | 62 | .type = ARM_CP_NO_RAW, .access = PL1_R, .readfn = isr_read }, |
69 | + FSL_IMX6_WDOG1_ADDR, | 63 | /* 32 bit ITLB invalidates */ |
70 | + FSL_IMX6_WDOG2_ADDR, | 64 | { .name = "ITLBIALL", .cp = 15, .opc1 = 0, .crn = 8, .crm = 5, .opc2 = 0, |
71 | + }; | 65 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo vmsa_pmsa_cp_reginfo[] = { |
72 | + | 66 | { .name = "FAR_EL1", .state = ARM_CP_STATE_AA64, |
73 | + object_property_set_bool(OBJECT(&s->wdt[i]), true, "realized", | 67 | .opc0 = 3, .crn = 6, .crm = 0, .opc1 = 0, .opc2 = 0, |
74 | + &error_abort); | 68 | .access = PL1_RW, .accessfn = access_tvm_trvm, |
75 | + | 69 | + .fgt = FGT_FAR_EL1, |
76 | + sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt[i]), 0, FSL_IMX6_WDOGn_ADDR[i]); | 70 | .fieldoffset = offsetof(CPUARMState, cp15.far_el[1]), |
77 | + } | 71 | .resetvalue = 0, }, |
78 | + | 72 | }; |
79 | /* ROM memory */ | 73 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo vmsa_cp_reginfo[] = { |
80 | memory_region_init_rom(&s->rom, NULL, "imx6.rom", | 74 | { .name = "ESR_EL1", .state = ARM_CP_STATE_AA64, |
81 | FSL_IMX6_ROM_SIZE, &err); | 75 | .opc0 = 3, .crn = 5, .crm = 2, .opc1 = 0, .opc2 = 0, |
76 | .access = PL1_RW, .accessfn = access_tvm_trvm, | ||
77 | + .fgt = FGT_ESR_EL1, | ||
78 | .fieldoffset = offsetof(CPUARMState, cp15.esr_el[1]), .resetvalue = 0, }, | ||
79 | { .name = "TTBR0_EL1", .state = ARM_CP_STATE_BOTH, | ||
80 | .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 0, .opc2 = 0, | ||
81 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { | ||
82 | { .name = "DCZID_EL0", .state = ARM_CP_STATE_AA64, | ||
83 | .opc0 = 3, .opc1 = 3, .opc2 = 7, .crn = 0, .crm = 0, | ||
84 | .access = PL0_R, .type = ARM_CP_NO_RAW, | ||
85 | + .fgt = FGT_DCZID_EL0, | ||
86 | .readfn = aa64_dczid_read }, | ||
87 | { .name = "DC_ZVA", .state = ARM_CP_STATE_AA64, | ||
88 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 4, .opc2 = 1, | ||
89 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo lor_reginfo[] = { | ||
90 | { .name = "LORSA_EL1", .state = ARM_CP_STATE_AA64, | ||
91 | .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 0, | ||
92 | .access = PL1_RW, .accessfn = access_lor_other, | ||
93 | + .fgt = FGT_LORSA_EL1, | ||
94 | .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
95 | { .name = "LOREA_EL1", .state = ARM_CP_STATE_AA64, | ||
96 | .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 1, | ||
97 | .access = PL1_RW, .accessfn = access_lor_other, | ||
98 | + .fgt = FGT_LOREA_EL1, | ||
99 | .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
100 | { .name = "LORN_EL1", .state = ARM_CP_STATE_AA64, | ||
101 | .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 2, | ||
102 | .access = PL1_RW, .accessfn = access_lor_other, | ||
103 | + .fgt = FGT_LORN_EL1, | ||
104 | .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
105 | { .name = "LORC_EL1", .state = ARM_CP_STATE_AA64, | ||
106 | .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 3, | ||
107 | .access = PL1_RW, .accessfn = access_lor_other, | ||
108 | + .fgt = FGT_LORC_EL1, | ||
109 | .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
110 | { .name = "LORID_EL1", .state = ARM_CP_STATE_AA64, | ||
111 | .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 7, | ||
112 | .access = PL1_R, .accessfn = access_lor_ns, | ||
113 | + .fgt = FGT_LORID_EL1, | ||
114 | .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
115 | }; | ||
116 | |||
117 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
118 | { .name = "CTR_EL0", .state = ARM_CP_STATE_AA64, | ||
119 | .opc0 = 3, .opc1 = 3, .opc2 = 1, .crn = 0, .crm = 0, | ||
120 | .access = PL0_R, .accessfn = ctr_el0_access, | ||
121 | + .fgt = FGT_CTR_EL0, | ||
122 | .type = ARM_CP_CONST, .resetvalue = cpu->ctr }, | ||
123 | /* TCMTR and TLBTR exist in v8 but have no 64-bit versions */ | ||
124 | { .name = "TCMTR", | ||
82 | -- | 125 | -- |
83 | 2.20.1 | 126 | 2.34.1 |
84 | |||
85 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Heyi Guo <guoheyi@huawei.com> | ||
2 | 1 | ||
3 | We are going to change ARM virt ACPI DSDT table, which will cause make | ||
4 | check to fail, so temporarily add related golden masters to ignore | ||
5 | list. | ||
6 | |||
7 | Signed-off-by: Heyi Guo <guoheyi@huawei.com> | ||
8 | Reviewed-by: Michael S. Tsirkin <mst@redhat.com> | ||
9 | Message-id: 20200204014325.16279-2-guoheyi@huawei.com | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | tests/qtest/bios-tables-test-allowed-diff.h | 3 +++ | ||
13 | 1 file changed, 3 insertions(+) | ||
14 | |||
15 | diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/tests/qtest/bios-tables-test-allowed-diff.h | ||
18 | +++ b/tests/qtest/bios-tables-test-allowed-diff.h | ||
19 | @@ -1 +1,4 @@ | ||
20 | /* List of comma-separated changed AML files to ignore */ | ||
21 | +"tests/data/acpi/virt/DSDT", | ||
22 | +"tests/data/acpi/virt/DSDT.memhp", | ||
23 | +"tests/data/acpi/virt/DSDT.numamem", | ||
24 | -- | ||
25 | 2.20.1 | ||
26 | |||
27 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Heyi Guo <guoheyi@huawei.com> | ||
2 | 1 | ||
3 | The sub device "RP0" under PCI0 in ACPI/DSDT does not contain any | ||
4 | method or property other than "_ADR", so it is safe to remove it. | ||
5 | |||
6 | Signed-off-by: Heyi Guo <guoheyi@huawei.com> | ||
7 | Acked-by: "Michael S. Tsirkin" <mst@redhat.com> | ||
8 | Reviewed-by: Michael S. Tsirkin <mst@redhat.com> | ||
9 | Message-id: 20200204014325.16279-3-guoheyi@huawei.com | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | hw/arm/virt-acpi-build.c | 4 ---- | ||
13 | 1 file changed, 4 deletions(-) | ||
14 | |||
15 | diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/hw/arm/virt-acpi-build.c | ||
18 | +++ b/hw/arm/virt-acpi-build.c | ||
19 | @@ -XXX,XX +XXX,XX @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, | ||
20 | aml_append(method, aml_return(buf)); | ||
21 | aml_append(dev, method); | ||
22 | |||
23 | - Aml *dev_rp0 = aml_device("%s", "RP0"); | ||
24 | - aml_append(dev_rp0, aml_name_decl("_ADR", aml_int(0))); | ||
25 | - aml_append(dev, dev_rp0); | ||
26 | - | ||
27 | Aml *dev_res0 = aml_device("%s", "RES0"); | ||
28 | aml_append(dev_res0, aml_name_decl("_HID", aml_string("PNP0C02"))); | ||
29 | crs = aml_resource_template(); | ||
30 | -- | ||
31 | 2.20.1 | ||
32 | |||
33 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Heyi Guo <guoheyi@huawei.com> | ||
2 | 1 | ||
3 | According to ACPI spec, _ADR should be used for device on a bus that | ||
4 | has a standard enumeration algorithm, but not for device which is on | ||
5 | system bus and must be enumerated by OSPM. And it is not recommended | ||
6 | to contain both _HID and _ADR in a single device. | ||
7 | |||
8 | See ACPI 6.3, section 6.1, top of page 343: | ||
9 | |||
10 | A device object must contain either an _HID object or an _ADR object, | ||
11 | but should not contain both. | ||
12 | |||
13 | (https://uefi.org/sites/default/files/resources/ACPI_6_3_May16.pdf) | ||
14 | |||
15 | Signed-off-by: Heyi Guo <guoheyi@huawei.com> | ||
16 | Acked-by: Igor Mammedov <imammedo@redhat.com> | ||
17 | Acked-by: Michael S. Tsirkin <mst@redhat.com> | ||
18 | Reviewed-by: Michael S. Tsirkin <mst@redhat.com> | ||
19 | Message-id: 20200204014325.16279-4-guoheyi@huawei.com | ||
20 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
21 | --- | ||
22 | hw/arm/virt-acpi-build.c | 8 -------- | ||
23 | 1 file changed, 8 deletions(-) | ||
24 | |||
25 | diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c | ||
26 | index XXXXXXX..XXXXXXX 100644 | ||
27 | --- a/hw/arm/virt-acpi-build.c | ||
28 | +++ b/hw/arm/virt-acpi-build.c | ||
29 | @@ -XXX,XX +XXX,XX @@ static void acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart_memmap, | ||
30 | AML_EXCLUSIVE, &uart_irq, 1)); | ||
31 | aml_append(dev, aml_name_decl("_CRS", crs)); | ||
32 | |||
33 | - /* The _ADR entry is used to link this device to the UART described | ||
34 | - * in the SPCR table, i.e. SPCR.base_address.address == _ADR. | ||
35 | - */ | ||
36 | - aml_append(dev, aml_name_decl("_ADR", aml_int(uart_memmap->base))); | ||
37 | - | ||
38 | aml_append(scope, dev); | ||
39 | } | ||
40 | |||
41 | @@ -XXX,XX +XXX,XX @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, | ||
42 | aml_append(dev, aml_name_decl("_CID", aml_string("PNP0A03"))); | ||
43 | aml_append(dev, aml_name_decl("_SEG", aml_int(0))); | ||
44 | aml_append(dev, aml_name_decl("_BBN", aml_int(0))); | ||
45 | - aml_append(dev, aml_name_decl("_ADR", aml_int(0))); | ||
46 | aml_append(dev, aml_name_decl("_UID", aml_string("PCI0"))); | ||
47 | aml_append(dev, aml_name_decl("_STR", aml_unicode("PCIe 0 Device"))); | ||
48 | aml_append(dev, aml_name_decl("_CCA", aml_int(1))); | ||
49 | @@ -XXX,XX +XXX,XX @@ static void acpi_dsdt_add_gpio(Aml *scope, const MemMapEntry *gpio_memmap, | ||
50 | { | ||
51 | Aml *dev = aml_device("GPO0"); | ||
52 | aml_append(dev, aml_name_decl("_HID", aml_string("ARMH0061"))); | ||
53 | - aml_append(dev, aml_name_decl("_ADR", aml_int(0))); | ||
54 | aml_append(dev, aml_name_decl("_UID", aml_int(0))); | ||
55 | |||
56 | Aml *crs = aml_resource_template(); | ||
57 | @@ -XXX,XX +XXX,XX @@ static void acpi_dsdt_add_power_button(Aml *scope) | ||
58 | { | ||
59 | Aml *dev = aml_device(ACPI_POWER_BUTTON_DEVICE); | ||
60 | aml_append(dev, aml_name_decl("_HID", aml_string("PNP0C0C"))); | ||
61 | - aml_append(dev, aml_name_decl("_ADR", aml_int(0))); | ||
62 | aml_append(dev, aml_name_decl("_UID", aml_int(0))); | ||
63 | aml_append(scope, dev); | ||
64 | } | ||
65 | -- | ||
66 | 2.20.1 | ||
67 | |||
68 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Heyi Guo <guoheyi@huawei.com> | ||
2 | 1 | ||
3 | The address field in each _PRT mapping package should be constructed | ||
4 | with high word for device# and low word for function#, so it is wrong | ||
5 | to use bus_no as the high word. The existing code adds a bunch useless | ||
6 | entries with device #s above 31. Enumerate all possible slots | ||
7 | (i.e. PCI_SLOT_MAX) instead. | ||
8 | |||
9 | Signed-off-by: Heyi Guo <guoheyi@huawei.com> | ||
10 | Reviewed-by: Michael S. Tsirkin <mst@redhat.com> | ||
11 | Message-id: 20200204014325.16279-5-guoheyi@huawei.com | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | hw/arm/virt-acpi-build.c | 10 +++++----- | ||
15 | 1 file changed, 5 insertions(+), 5 deletions(-) | ||
16 | |||
17 | diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/hw/arm/virt-acpi-build.c | ||
20 | +++ b/hw/arm/virt-acpi-build.c | ||
21 | @@ -XXX,XX +XXX,XX @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, | ||
22 | { | ||
23 | int ecam_id = VIRT_ECAM_ID(highmem_ecam); | ||
24 | Aml *method, *crs, *ifctx, *UUID, *ifctx1, *elsectx, *buf; | ||
25 | - int i, bus_no; | ||
26 | + int i, slot_no; | ||
27 | hwaddr base_mmio = memmap[VIRT_PCIE_MMIO].base; | ||
28 | hwaddr size_mmio = memmap[VIRT_PCIE_MMIO].size; | ||
29 | hwaddr base_pio = memmap[VIRT_PCIE_PIO].base; | ||
30 | @@ -XXX,XX +XXX,XX @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, | ||
31 | aml_append(dev, aml_name_decl("_CCA", aml_int(1))); | ||
32 | |||
33 | /* Declare the PCI Routing Table. */ | ||
34 | - Aml *rt_pkg = aml_varpackage(nr_pcie_buses * PCI_NUM_PINS); | ||
35 | - for (bus_no = 0; bus_no < nr_pcie_buses; bus_no++) { | ||
36 | + Aml *rt_pkg = aml_varpackage(PCI_SLOT_MAX * PCI_NUM_PINS); | ||
37 | + for (slot_no = 0; slot_no < PCI_SLOT_MAX; slot_no++) { | ||
38 | for (i = 0; i < PCI_NUM_PINS; i++) { | ||
39 | - int gsi = (i + bus_no) % PCI_NUM_PINS; | ||
40 | + int gsi = (i + slot_no) % PCI_NUM_PINS; | ||
41 | Aml *pkg = aml_package(4); | ||
42 | - aml_append(pkg, aml_int((bus_no << 16) | 0xFFFF)); | ||
43 | + aml_append(pkg, aml_int((slot_no << 16) | 0xFFFF)); | ||
44 | aml_append(pkg, aml_int(i)); | ||
45 | aml_append(pkg, aml_name("GSI%d", gsi)); | ||
46 | aml_append(pkg, aml_int(0)); | ||
47 | -- | ||
48 | 2.20.1 | ||
49 | |||
50 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Heyi Guo <guoheyi@huawei.com> | ||
2 | 1 | ||
3 | Using _UID of 0 for all PCI interrupt link devices absolutely violates | ||
4 | the spec. Simply increase one by one. | ||
5 | |||
6 | Signed-off-by: Heyi Guo <guoheyi@huawei.com> | ||
7 | Reviewed-by: Michael S. Tsirkin <mst@redhat.com> | ||
8 | Message-id: 20200204014325.16279-6-guoheyi@huawei.com | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | hw/arm/virt-acpi-build.c | 2 +- | ||
12 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
13 | |||
14 | diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/hw/arm/virt-acpi-build.c | ||
17 | +++ b/hw/arm/virt-acpi-build.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, | ||
19 | uint32_t irqs = irq + i; | ||
20 | Aml *dev_gsi = aml_device("GSI%d", i); | ||
21 | aml_append(dev_gsi, aml_name_decl("_HID", aml_string("PNP0C0F"))); | ||
22 | - aml_append(dev_gsi, aml_name_decl("_UID", aml_int(0))); | ||
23 | + aml_append(dev_gsi, aml_name_decl("_UID", aml_int(i))); | ||
24 | crs = aml_resource_template(); | ||
25 | aml_append(crs, | ||
26 | aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH, | ||
27 | -- | ||
28 | 2.20.1 | ||
29 | |||
30 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Heyi Guo <guoheyi@huawei.com> | ||
2 | 1 | ||
3 | Differences between disassembled ASL files: | ||
4 | |||
5 | @@ -XXX,XX +XXX,XX @@ | ||
6 | * | ||
7 | * Disassembling to symbolic ASL+ operators | ||
8 | * | ||
9 | - * Disassembly of DSDT, Thu Jan 23 16:00:04 2020 | ||
10 | + * Disassembly of DSDT.new, Thu Jan 23 16:47:12 2020 | ||
11 | * | ||
12 | * Original Table Header: | ||
13 | * Signature "DSDT" | ||
14 | - * Length 0x0000481E (18462) | ||
15 | + * Length 0x000014BB (5307) | ||
16 | * Revision 0x02 | ||
17 | - * Checksum 0x60 | ||
18 | + * Checksum 0xD1 | ||
19 | * OEM ID "BOCHS " | ||
20 | * OEM Table ID "BXPCDSDT" | ||
21 | * OEM Revision 0x00000001 (1) | ||
22 | @@ -XXX,XX +XXX,XX @@ DefinitionBlock ("", "DSDT", 2, "BOCHS ", "BXPCDSDT", 0x00000001) | ||
23 | 0x00000021, | ||
24 | } | ||
25 | }) | ||
26 | - Name (_ADR, 0x09000000) // _ADR: Address | ||
27 | } | ||
28 | |||
29 | Device (FLS0) | ||
30 | @@ -XXX,XX +XXX,XX @@ DefinitionBlock ("", "DSDT", 2, "BOCHS ", "BXPCDSDT", 0x00000001) | ||
31 | Name (_CID, "PNP0A03" /* PCI Bus */) // _CID: Compatible ID | ||
32 | Name (_SEG, Zero) // _SEG: PCI Segment | ||
33 | Name (_BBN, Zero) // _BBN: BIOS Bus Number | ||
34 | - Name (_ADR, Zero) // _ADR: Address | ||
35 | Name (_UID, "PCI0") // _UID: Unique ID | ||
36 | Name (_STR, Unicode ("PCIe 0 Device")) // _STR: Description String | ||
37 | Name (_CCA, One) // _CCA: Cache Coherency Attribute | ||
38 | - Name (_PRT, Package (0x0400) // _PRT: PCI Routing Table | ||
39 | + Name (_PRT, Package (0x80) // _PRT: PCI Routing Table | ||
40 | { | ||
41 | Package (0x04) | ||
42 | { | ||
43 | @@ -XXX,XX +XXX,XX @@ DefinitionBlock ("", "DSDT", 2, "BOCHS ", "BXPCDSDT", 0x00000001) | ||
44 | 0x03, | ||
45 | GSI2, | ||
46 | Zero | ||
47 | - }, | ||
48 | - | ||
49 | - Package (0x04) | ||
50 | - { | ||
51 | - 0x0020FFFF, | ||
52 | - Zero, | ||
53 | - GSI0, | ||
54 | - Zero | ||
55 | - }, | ||
56 | - | ||
57 | - *Omit the other (4 * (256 - 32) - 2) packages* | ||
58 | - | ||
59 | - Package (0x04) | ||
60 | - { | ||
61 | - 0x00FFFFFF, | ||
62 | - 0x03, | ||
63 | - GSI2, | ||
64 | - Zero | ||
65 | } | ||
66 | }) | ||
67 | Device (GSI0) | ||
68 | @@ -XXX,XX +XXX,XX @@ DefinitionBlock ("", "DSDT", 2, "BOCHS ", "BXPCDSDT", 0x00000001) | ||
69 | Device (GSI1) | ||
70 | { | ||
71 | Name (_HID, "PNP0C0F" /* PCI Interrupt Link Device */) // _HID: Hardware ID | ||
72 | - Name (_UID, Zero) // _UID: Unique ID | ||
73 | + Name (_UID, One) // _UID: Unique ID | ||
74 | Name (_PRS, ResourceTemplate () // _PRS: Possible Resource Settings | ||
75 | { | ||
76 | Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, ) | ||
77 | @@ -XXX,XX +XXX,XX @@ DefinitionBlock ("", "DSDT", 2, "BOCHS ", "BXPCDSDT", 0x00000001) | ||
78 | Device (GSI2) | ||
79 | { | ||
80 | Name (_HID, "PNP0C0F" /* PCI Interrupt Link Device */) // _HID: Hardware ID | ||
81 | - Name (_UID, Zero) // _UID: Unique ID | ||
82 | + Name (_UID, 0x02) // _UID: Unique ID | ||
83 | Name (_PRS, ResourceTemplate () // _PRS: Possible Resource Settings | ||
84 | { | ||
85 | Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, ) | ||
86 | @@ -XXX,XX +XXX,XX @@ DefinitionBlock ("", "DSDT", 2, "BOCHS ", "BXPCDSDT", 0x00000001) | ||
87 | Device (GSI3) | ||
88 | { | ||
89 | Name (_HID, "PNP0C0F" /* PCI Interrupt Link Device */) // _HID: Hardware ID | ||
90 | - Name (_UID, Zero) // _UID: Unique ID | ||
91 | + Name (_UID, 0x03) // _UID: Unique ID | ||
92 | Name (_PRS, ResourceTemplate () // _PRS: Possible Resource Settings | ||
93 | { | ||
94 | Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, ) | ||
95 | @@ -XXX,XX +XXX,XX @@ DefinitionBlock ("", "DSDT", 2, "BOCHS ", "BXPCDSDT", 0x00000001) | ||
96 | |||
97 | Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings | ||
98 | { | ||
99 | - Name (RBUF, ResourceTemplate () | ||
100 | - { | ||
101 | - WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, | ||
102 | - 0x0000, // Granularity | ||
103 | - 0x0000, // Range Minimum | ||
104 | - 0x00FF, // Range Maximum | ||
105 | - 0x0000, // Translation Offset | ||
106 | - 0x0100, // Length | ||
107 | - ,, ) | ||
108 | - DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite, | ||
109 | - 0x00000000, // Granularity | ||
110 | - 0x10000000, // Range Minimum | ||
111 | - 0x3EFEFFFF, // Range Maximum | ||
112 | - 0x00000000, // Translation Offset | ||
113 | - 0x2EFF0000, // Length | ||
114 | - ,, , AddressRangeMemory, TypeStatic) | ||
115 | - DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, | ||
116 | - 0x00000000, // Granularity | ||
117 | - 0x00000000, // Range Minimum | ||
118 | - 0x0000FFFF, // Range Maximum | ||
119 | - 0x3EFF0000, // Translation Offset | ||
120 | - 0x00010000, // Length | ||
121 | - ,, , TypeStatic, DenseTranslation) | ||
122 | - QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite, | ||
123 | - 0x0000000000000000, // Granularity | ||
124 | - 0x0000008000000000, // Range Minimum | ||
125 | - 0x000000FFFFFFFFFF, // Range Maximum | ||
126 | - 0x0000000000000000, // Translation Offset | ||
127 | - 0x0000008000000000, // Length | ||
128 | - ,, , AddressRangeMemory, TypeStatic) | ||
129 | - }) | ||
130 | Return (ResourceTemplate () | ||
131 | { | ||
132 | WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, | ||
133 | @@ -XXX,XX +XXX,XX @@ DefinitionBlock ("", "DSDT", 2, "BOCHS ", "BXPCDSDT", 0x00000001) | ||
134 | }) | ||
135 | } | ||
136 | |||
137 | - Device (RP0) | ||
138 | - { | ||
139 | - Name (_ADR, Zero) // _ADR: Address | ||
140 | - } | ||
141 | - | ||
142 | Device (RES0) | ||
143 | { | ||
144 | Name (_HID, "PNP0C02" /* PNP Motherboard Resources */) // _HID: Hardware ID | ||
145 | @@ -XXX,XX +XXX,XX @@ DefinitionBlock ("", "DSDT", 2, "BOCHS ", "BXPCDSDT", 0x00000001) | ||
146 | Device (PWRB) | ||
147 | { | ||
148 | Name (_HID, "PNP0C0C" /* Power Button Device */) // _HID: Hardware ID | ||
149 | - Name (_ADR, Zero) // _ADR: Address | ||
150 | Name (_UID, Zero) // _UID: Unique ID | ||
151 | } | ||
152 | } | ||
153 | |||
154 | The differences between the two versions of DSDT.memhp are almost the | ||
155 | same as the above, except for total length and checksum. | ||
156 | |||
157 | DSDT.numamem binary is just the same with DSDT on virt machine, so we | ||
158 | don't show the differences again. | ||
159 | |||
160 | Signed-off-by: Heyi Guo <guoheyi@huawei.com> | ||
161 | Reviewed-by: Michael S. Tsirkin <mst@redhat.com> | ||
162 | Message-id: 20200204014325.16279-8-guoheyi@huawei.com | ||
163 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
164 | --- | ||
165 | tests/qtest/bios-tables-test-allowed-diff.h | 3 --- | ||
166 | tests/data/acpi/virt/DSDT | Bin 18462 -> 5307 bytes | ||
167 | tests/data/acpi/virt/DSDT.memhp | Bin 19799 -> 6644 bytes | ||
168 | tests/data/acpi/virt/DSDT.numamem | Bin 18462 -> 5307 bytes | ||
169 | 4 files changed, 3 deletions(-) | ||
170 | |||
171 | diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h | ||
172 | index XXXXXXX..XXXXXXX 100644 | ||
173 | --- a/tests/qtest/bios-tables-test-allowed-diff.h | ||
174 | +++ b/tests/qtest/bios-tables-test-allowed-diff.h | ||
175 | @@ -1,4 +1 @@ | ||
176 | /* List of comma-separated changed AML files to ignore */ | ||
177 | -"tests/data/acpi/virt/DSDT", | ||
178 | -"tests/data/acpi/virt/DSDT.memhp", | ||
179 | -"tests/data/acpi/virt/DSDT.numamem", | ||
180 | diff --git a/tests/data/acpi/virt/DSDT b/tests/data/acpi/virt/DSDT | ||
181 | index XXXXXXX..XXXXXXX 100644 | ||
182 | GIT binary patch | ||
183 | delta 156 | ||
184 | zcmbO?fpNDcmrJlq$Zin^2BwP>xulufJQ*iyC^K43^tIeLL4lLWeZ}O>oO+X=b6T<Z | ||
185 | z6mvCfR_C%{pDgc^#>hCi&BajKi^V<I(}*M9!_$Q~z%RhS*}#o~BR<sAg^OwOMVP!X | ||
186 | lHhJdBGOmtnjvVpMLBX3Jy81CrwsAkqC^^YPgaxRb0RT`TDiQzy | ||
187 | |||
188 | literal 18462 | ||
189 | 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 | ||
265 | A00000 | ||
266 | |||
267 | diff --git a/tests/data/acpi/virt/DSDT.memhp b/tests/data/acpi/virt/DSDT.memhp | ||
268 | index XXXXXXX..XXXXXXX 100644 | ||
269 | GIT binary patch | ||
270 | delta 173 | ||
271 | zcmcaUi}8ywmrJlq$QMZl2ByY|T++<_a~LOTC^K43^tIeLL4lLWeZ}O>oO+X=b6T<Z | ||
272 | z6mvCfR_C%{pDgc^#>hCi&BajKi^V<I(}*M9!_$Q~z%RhS*}#o~BR<sAg^OwOMVP!X | ||
273 | pHhJdBGOmtnjvVpMLBX3Jy81D0wsHT%Dk&Kd9^{0q-Wg&Z0|3#tFC_o~ | ||
274 | |||
275 | literal 19799 | ||
276 | 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 | ||
365 | DDbP3` | ||
366 | |||
367 | diff --git a/tests/data/acpi/virt/DSDT.numamem b/tests/data/acpi/virt/DSDT.numamem | ||
368 | index XXXXXXX..XXXXXXX 100644 | ||
369 | GIT binary patch | ||
370 | delta 156 | ||
371 | zcmbO?fpNDcmrJlq$Zin^2BwP>xulufJQ*iyC^K43^tIeLL4lLWeZ}O>oO+X=b6T<Z | ||
372 | z6mvCfR_C%{pDgc^#>hCi&BajKi^V<I(}*M9!_$Q~z%RhS*}#o~BR<sAg^OwOMVP!X | ||
373 | lHhJdBGOmtnjvVpMLBX3Jy81CrwsAkqC^^YPgaxRb0RT`TDiQzy | ||
374 | |||
375 | literal 18462 | ||
376 | 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 | ||
452 | A00000 | ||
453 | |||
454 | -- | ||
455 | 2.20.1 | ||
456 | |||
457 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | Mark up the sysreg definitions for the registers trapped |
---|---|---|---|
2 | by HFGRTR/HFGWTR bits 24..35. | ||
2 | 3 | ||
3 | This is a minor enhancement over ARMv8.1-PAN. | 4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | The *_PAN mmu_idx are used with the existing do_ats_write. | 5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Tested-by: Fuad Tabba <tabba@google.com> | ||
7 | Message-id: 20230130182459.3309057-13-peter.maydell@linaro.org | ||
8 | Message-id: 20230127175507.2895013-13-peter.maydell@linaro.org | ||
9 | --- | ||
10 | target/arm/cpregs.h | 12 ++++++++++++ | ||
11 | target/arm/helper.c | 14 ++++++++++++++ | ||
12 | 2 files changed, 26 insertions(+) | ||
5 | 13 | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 14 | diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h |
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 15 | index XXXXXXX..XXXXXXX 100644 |
8 | Message-id: 20200208125816.14954-16-richard.henderson@linaro.org | 16 | --- a/target/arm/cpregs.h |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 17 | +++ b/target/arm/cpregs.h |
10 | --- | 18 | @@ -XXX,XX +XXX,XX @@ typedef enum FGTBit { |
11 | target/arm/helper.c | 56 ++++++++++++++++++++++++++++++++++++++++----- | 19 | DO_BIT(HFGRTR, LORID_EL1), |
12 | 1 file changed, 50 insertions(+), 6 deletions(-) | 20 | DO_BIT(HFGRTR, LORN_EL1), |
13 | 21 | DO_BIT(HFGRTR, LORSA_EL1), | |
22 | + DO_BIT(HFGRTR, MAIR_EL1), | ||
23 | + DO_BIT(HFGRTR, MIDR_EL1), | ||
24 | + DO_BIT(HFGRTR, MPIDR_EL1), | ||
25 | + DO_BIT(HFGRTR, PAR_EL1), | ||
26 | + DO_BIT(HFGRTR, REVIDR_EL1), | ||
27 | + DO_BIT(HFGRTR, SCTLR_EL1), | ||
28 | + DO_BIT(HFGRTR, SCXTNUM_EL1), | ||
29 | + DO_BIT(HFGRTR, SCXTNUM_EL0), | ||
30 | + DO_BIT(HFGRTR, TCR_EL1), | ||
31 | + DO_BIT(HFGRTR, TPIDR_EL1), | ||
32 | + DO_BIT(HFGRTR, TPIDRRO_EL0), | ||
33 | + DO_BIT(HFGRTR, TPIDR_EL0), | ||
34 | } FGTBit; | ||
35 | |||
36 | #undef DO_BIT | ||
14 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 37 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
15 | index XXXXXXX..XXXXXXX 100644 | 38 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/helper.c | 39 | --- a/target/arm/helper.c |
17 | +++ b/target/arm/helper.c | 40 | +++ b/target/arm/helper.c |
18 | @@ -XXX,XX +XXX,XX @@ static void ats_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) | 41 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = { |
19 | 42 | { .name = "MAIR_EL1", .state = ARM_CP_STATE_AA64, | |
20 | switch (ri->opc2 & 6) { | 43 | .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 2, .opc2 = 0, |
21 | case 0: | 44 | .access = PL1_RW, .accessfn = access_tvm_trvm, |
22 | - /* stage 1 current state PL1: ATS1CPR, ATS1CPW */ | 45 | + .fgt = FGT_MAIR_EL1, |
23 | + /* stage 1 current state PL1: ATS1CPR, ATS1CPW, ATS1CPRP, ATS1CPWP */ | 46 | .fieldoffset = offsetof(CPUARMState, cp15.mair_el[1]), |
24 | switch (el) { | 47 | .resetvalue = 0 }, |
25 | case 3: | 48 | { .name = "MAIR_EL3", .state = ARM_CP_STATE_AA64, |
26 | mmu_idx = ARMMMUIdx_SE3; | 49 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v6k_cp_reginfo[] = { |
27 | break; | 50 | { .name = "TPIDR_EL0", .state = ARM_CP_STATE_AA64, |
28 | case 2: | 51 | .opc0 = 3, .opc1 = 3, .opc2 = 2, .crn = 13, .crm = 0, |
29 | - mmu_idx = ARMMMUIdx_Stage1_E1; | 52 | .access = PL0_RW, |
30 | - break; | 53 | + .fgt = FGT_TPIDR_EL0, |
31 | + g_assert(!secure); /* TODO: ARMv8.4-SecEL2 */ | 54 | .fieldoffset = offsetof(CPUARMState, cp15.tpidr_el[0]), .resetvalue = 0 }, |
32 | + /* fall through */ | 55 | { .name = "TPIDRURW", .cp = 15, .crn = 13, .crm = 0, .opc1 = 0, .opc2 = 2, |
33 | case 1: | 56 | .access = PL0_RW, |
34 | - mmu_idx = secure ? ARMMMUIdx_SE10_1 : ARMMMUIdx_Stage1_E1; | 57 | + .fgt = FGT_TPIDR_EL0, |
35 | + if (ri->crm == 9 && (env->uncached_cpsr & CPSR_PAN)) { | 58 | .bank_fieldoffsets = { offsetoflow32(CPUARMState, cp15.tpidrurw_s), |
36 | + mmu_idx = (secure ? ARMMMUIdx_SE10_1_PAN | 59 | offsetoflow32(CPUARMState, cp15.tpidrurw_ns) }, |
37 | + : ARMMMUIdx_Stage1_E1_PAN); | 60 | .resetfn = arm_cp_reset_ignore }, |
38 | + } else { | 61 | { .name = "TPIDRRO_EL0", .state = ARM_CP_STATE_AA64, |
39 | + mmu_idx = secure ? ARMMMUIdx_SE10_1 : ARMMMUIdx_Stage1_E1; | 62 | .opc0 = 3, .opc1 = 3, .opc2 = 3, .crn = 13, .crm = 0, |
40 | + } | 63 | .access = PL0_R | PL1_W, |
41 | break; | 64 | + .fgt = FGT_TPIDRRO_EL0, |
42 | default: | 65 | .fieldoffset = offsetof(CPUARMState, cp15.tpidrro_el[0]), |
43 | g_assert_not_reached(); | 66 | .resetvalue = 0}, |
44 | @@ -XXX,XX +XXX,XX @@ static void ats_write64(CPUARMState *env, const ARMCPRegInfo *ri, | 67 | { .name = "TPIDRURO", .cp = 15, .crn = 13, .crm = 0, .opc1 = 0, .opc2 = 3, |
45 | switch (ri->opc2 & 6) { | 68 | .access = PL0_R | PL1_W, |
46 | case 0: | 69 | + .fgt = FGT_TPIDRRO_EL0, |
47 | switch (ri->opc1) { | 70 | .bank_fieldoffsets = { offsetoflow32(CPUARMState, cp15.tpidruro_s), |
48 | - case 0: /* AT S1E1R, AT S1E1W */ | 71 | offsetoflow32(CPUARMState, cp15.tpidruro_ns) }, |
49 | - mmu_idx = secure ? ARMMMUIdx_SE10_1 : ARMMMUIdx_Stage1_E1; | 72 | .resetfn = arm_cp_reset_ignore }, |
50 | + case 0: /* AT S1E1R, AT S1E1W, AT S1E1RP, AT S1E1WP */ | 73 | { .name = "TPIDR_EL1", .state = ARM_CP_STATE_AA64, |
51 | + if (ri->crm == 9 && (env->pstate & PSTATE_PAN)) { | 74 | .opc0 = 3, .opc1 = 0, .opc2 = 4, .crn = 13, .crm = 0, |
52 | + mmu_idx = (secure ? ARMMMUIdx_SE10_1_PAN | 75 | .access = PL1_RW, |
53 | + : ARMMMUIdx_Stage1_E1_PAN); | 76 | + .fgt = FGT_TPIDR_EL1, |
54 | + } else { | 77 | .fieldoffset = offsetof(CPUARMState, cp15.tpidr_el[1]), .resetvalue = 0 }, |
55 | + mmu_idx = secure ? ARMMMUIdx_SE10_1 : ARMMMUIdx_Stage1_E1; | 78 | { .name = "TPIDRPRW", .opc1 = 0, .cp = 15, .crn = 13, .crm = 0, .opc2 = 4, |
56 | + } | 79 | .access = PL1_RW, |
57 | break; | 80 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo vmsa_cp_reginfo[] = { |
58 | case 4: /* AT S1E2R, AT S1E2W */ | 81 | { .name = "TCR_EL1", .state = ARM_CP_STATE_AA64, |
59 | mmu_idx = ARMMMUIdx_E2; | 82 | .opc0 = 3, .crn = 2, .crm = 0, .opc1 = 0, .opc2 = 2, |
60 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo vhe_reginfo[] = { | 83 | .access = PL1_RW, .accessfn = access_tvm_trvm, |
61 | REGINFO_SENTINEL | 84 | + .fgt = FGT_TCR_EL1, |
62 | }; | 85 | .writefn = vmsa_tcr_el12_write, |
63 | 86 | .raw_writefn = raw_write, | |
64 | +#ifndef CONFIG_USER_ONLY | 87 | .resetvalue = 0, |
65 | +static const ARMCPRegInfo ats1e1_reginfo[] = { | 88 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { |
66 | + { .name = "AT_S1E1R", .state = ARM_CP_STATE_AA64, | 89 | .type = ARM_CP_ALIAS, |
67 | + .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 9, .opc2 = 0, | 90 | .opc0 = 3, .opc1 = 0, .crn = 7, .crm = 4, .opc2 = 0, |
68 | + .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, | 91 | .access = PL1_RW, .resetvalue = 0, |
69 | + .writefn = ats_write64 }, | 92 | + .fgt = FGT_PAR_EL1, |
70 | + { .name = "AT_S1E1W", .state = ARM_CP_STATE_AA64, | 93 | .fieldoffset = offsetof(CPUARMState, cp15.par_el[1]), |
71 | + .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 9, .opc2 = 1, | 94 | .writefn = par_write }, |
72 | + .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, | 95 | #endif |
73 | + .writefn = ats_write64 }, | 96 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo scxtnum_reginfo[] = { |
74 | + REGINFO_SENTINEL | 97 | { .name = "SCXTNUM_EL0", .state = ARM_CP_STATE_AA64, |
75 | +}; | 98 | .opc0 = 3, .opc1 = 3, .crn = 13, .crm = 0, .opc2 = 7, |
76 | + | 99 | .access = PL0_RW, .accessfn = access_scxtnum, |
77 | +static const ARMCPRegInfo ats1cp_reginfo[] = { | 100 | + .fgt = FGT_SCXTNUM_EL0, |
78 | + { .name = "ATS1CPRP", | 101 | .fieldoffset = offsetof(CPUARMState, scxtnum_el[0]) }, |
79 | + .cp = 15, .opc1 = 0, .crn = 7, .crm = 9, .opc2 = 0, | 102 | { .name = "SCXTNUM_EL1", .state = ARM_CP_STATE_AA64, |
80 | + .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, | 103 | .opc0 = 3, .opc1 = 0, .crn = 13, .crm = 0, .opc2 = 7, |
81 | + .writefn = ats_write }, | 104 | .access = PL1_RW, .accessfn = access_scxtnum, |
82 | + { .name = "ATS1CPWP", | 105 | + .fgt = FGT_SCXTNUM_EL1, |
83 | + .cp = 15, .opc1 = 0, .crn = 7, .crm = 9, .opc2 = 1, | 106 | .fieldoffset = offsetof(CPUARMState, scxtnum_el[1]) }, |
84 | + .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, | 107 | { .name = "SCXTNUM_EL2", .state = ARM_CP_STATE_AA64, |
85 | + .writefn = ats_write }, | 108 | .opc0 = 3, .opc1 = 4, .crn = 13, .crm = 0, .opc2 = 7, |
86 | + REGINFO_SENTINEL | ||
87 | +}; | ||
88 | +#endif | ||
89 | + | ||
90 | void register_cp_regs_for_features(ARMCPU *cpu) | ||
91 | { | ||
92 | /* Register all the coprocessor registers based on feature bits */ | ||
93 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | 109 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) |
94 | if (cpu_isar_feature(aa64_pan, cpu)) { | 110 | { .name = "MIDR_EL1", .state = ARM_CP_STATE_BOTH, |
95 | define_one_arm_cp_reg(cpu, &pan_reginfo); | 111 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 0, .opc2 = 0, |
96 | } | 112 | .access = PL1_R, .type = ARM_CP_NO_RAW, .resetvalue = cpu->midr, |
97 | +#ifndef CONFIG_USER_ONLY | 113 | + .fgt = FGT_MIDR_EL1, |
98 | + if (cpu_isar_feature(aa64_ats1e1, cpu)) { | 114 | .fieldoffset = offsetof(CPUARMState, cp15.c0_cpuid), |
99 | + define_arm_cp_regs(cpu, ats1e1_reginfo); | 115 | .readfn = midr_read }, |
100 | + } | 116 | /* crn = 0 op1 = 0 crm = 0 op2 = 7 : AArch32 aliases of MIDR */ |
101 | + if (cpu_isar_feature(aa32_ats1e1, cpu)) { | 117 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) |
102 | + define_arm_cp_regs(cpu, ats1cp_reginfo); | 118 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 0, .opc2 = 6, |
103 | + } | 119 | .access = PL1_R, |
104 | +#endif | 120 | .accessfn = access_aa64_tid1, |
105 | 121 | + .fgt = FGT_REVIDR_EL1, | |
106 | if (arm_feature(env, ARM_FEATURE_EL2) && cpu_isar_feature(aa64_vh, cpu)) { | 122 | .type = ARM_CP_CONST, .resetvalue = cpu->revidr }, |
107 | define_arm_cp_regs(cpu, vhe_reginfo); | 123 | }; |
124 | ARMCPRegInfo id_v8_midr_alias_cp_reginfo = { | ||
125 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
126 | ARMCPRegInfo mpidr_cp_reginfo[] = { | ||
127 | { .name = "MPIDR_EL1", .state = ARM_CP_STATE_BOTH, | ||
128 | .opc0 = 3, .crn = 0, .crm = 0, .opc1 = 0, .opc2 = 5, | ||
129 | + .fgt = FGT_MPIDR_EL1, | ||
130 | .access = PL1_R, .readfn = mpidr_read, .type = ARM_CP_NO_RAW }, | ||
131 | }; | ||
132 | #ifdef CONFIG_USER_ONLY | ||
133 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
134 | .name = "SCTLR", .state = ARM_CP_STATE_BOTH, | ||
135 | .opc0 = 3, .opc1 = 0, .crn = 1, .crm = 0, .opc2 = 0, | ||
136 | .access = PL1_RW, .accessfn = access_tvm_trvm, | ||
137 | + .fgt = FGT_SCTLR_EL1, | ||
138 | .bank_fieldoffsets = { offsetof(CPUARMState, cp15.sctlr_s), | ||
139 | offsetof(CPUARMState, cp15.sctlr_ns) }, | ||
140 | .writefn = sctlr_write, .resetvalue = cpu->reset_sctlr, | ||
108 | -- | 141 | -- |
109 | 2.20.1 | 142 | 2.34.1 |
110 | |||
111 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | Mark up the sysreg definitions for the registers trapped |
---|---|---|---|
2 | by HFGRTR/HFGWTR bits 36..63. | ||
2 | 3 | ||
3 | Add definitions for all of the fields, up to ARMv8.5. | 4 | Of these, some correspond to RAS registers which we implement as |
4 | Convert the existing RESERVED register to a full register. | 5 | always-UNDEF: these don't need any extra handling for FGT because the |
5 | Query KVM for the value of the register for the host. | 6 | UNDEF-to-EL1 always takes priority over any theoretical |
7 | FGT-trap-to-EL2. | ||
6 | 8 | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Bit 50 (NACCDATA_EL1) is for the ACCDATA_EL1 register which is part |
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 10 | of the FEAT_LS64_ACCDATA feature which we don't yet implement. |
9 | Message-id: 20200208125816.14954-18-richard.henderson@linaro.org | 11 | |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
14 | Tested-by: Fuad Tabba <tabba@google.com> | ||
15 | Message-id: 20230130182459.3309057-14-peter.maydell@linaro.org | ||
16 | Message-id: 20230127175507.2895013-14-peter.maydell@linaro.org | ||
11 | --- | 17 | --- |
12 | target/arm/cpu.h | 17 +++++++++++++++++ | 18 | target/arm/cpregs.h | 7 +++++++ |
13 | target/arm/helper.c | 4 ++-- | 19 | hw/intc/arm_gicv3_cpuif.c | 2 ++ |
14 | target/arm/kvm64.c | 2 ++ | 20 | target/arm/helper.c | 10 ++++++++++ |
15 | 3 files changed, 21 insertions(+), 2 deletions(-) | 21 | 3 files changed, 19 insertions(+) |
16 | 22 | ||
17 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 23 | diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h |
18 | index XXXXXXX..XXXXXXX 100644 | 24 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/target/arm/cpu.h | 25 | --- a/target/arm/cpregs.h |
20 | +++ b/target/arm/cpu.h | 26 | +++ b/target/arm/cpregs.h |
21 | @@ -XXX,XX +XXX,XX @@ struct ARMCPU { | 27 | @@ -XXX,XX +XXX,XX @@ typedef enum FGTBit { |
22 | uint64_t id_aa64pfr1; | 28 | DO_BIT(HFGRTR, TPIDR_EL1), |
23 | uint64_t id_aa64mmfr0; | 29 | DO_BIT(HFGRTR, TPIDRRO_EL0), |
24 | uint64_t id_aa64mmfr1; | 30 | DO_BIT(HFGRTR, TPIDR_EL0), |
25 | + uint64_t id_aa64mmfr2; | 31 | + DO_BIT(HFGRTR, TTBR0_EL1), |
26 | } isar; | 32 | + DO_BIT(HFGRTR, TTBR1_EL1), |
27 | uint32_t midr; | 33 | + DO_BIT(HFGRTR, VBAR_EL1), |
28 | uint32_t revidr; | 34 | + DO_BIT(HFGRTR, ICC_IGRPENN_EL1), |
29 | @@ -XXX,XX +XXX,XX @@ FIELD(ID_AA64MMFR1, PAN, 20, 4) | 35 | + DO_BIT(HFGRTR, ERRIDR_EL1), |
30 | FIELD(ID_AA64MMFR1, SPECSEI, 24, 4) | 36 | + DO_REV_BIT(HFGRTR, NSMPRI_EL1), |
31 | FIELD(ID_AA64MMFR1, XNX, 28, 4) | 37 | + DO_REV_BIT(HFGRTR, NTPIDR2_EL0), |
32 | 38 | } FGTBit; | |
33 | +FIELD(ID_AA64MMFR2, CNP, 0, 4) | 39 | |
34 | +FIELD(ID_AA64MMFR2, UAO, 4, 4) | 40 | #undef DO_BIT |
35 | +FIELD(ID_AA64MMFR2, LSM, 8, 4) | 41 | diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c |
36 | +FIELD(ID_AA64MMFR2, IESB, 12, 4) | 42 | index XXXXXXX..XXXXXXX 100644 |
37 | +FIELD(ID_AA64MMFR2, VARANGE, 16, 4) | 43 | --- a/hw/intc/arm_gicv3_cpuif.c |
38 | +FIELD(ID_AA64MMFR2, CCIDX, 20, 4) | 44 | +++ b/hw/intc/arm_gicv3_cpuif.c |
39 | +FIELD(ID_AA64MMFR2, NV, 24, 4) | 45 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo gicv3_cpuif_reginfo[] = { |
40 | +FIELD(ID_AA64MMFR2, ST, 28, 4) | 46 | .opc0 = 3, .opc1 = 0, .crn = 12, .crm = 12, .opc2 = 6, |
41 | +FIELD(ID_AA64MMFR2, AT, 32, 4) | 47 | .type = ARM_CP_IO | ARM_CP_NO_RAW, |
42 | +FIELD(ID_AA64MMFR2, IDS, 36, 4) | 48 | .access = PL1_RW, .accessfn = gicv3_fiq_access, |
43 | +FIELD(ID_AA64MMFR2, FWB, 40, 4) | 49 | + .fgt = FGT_ICC_IGRPENN_EL1, |
44 | +FIELD(ID_AA64MMFR2, TTL, 48, 4) | 50 | .readfn = icc_igrpen_read, |
45 | +FIELD(ID_AA64MMFR2, BBM, 52, 4) | 51 | .writefn = icc_igrpen_write, |
46 | +FIELD(ID_AA64MMFR2, EVT, 56, 4) | 52 | }, |
47 | +FIELD(ID_AA64MMFR2, E0PD, 60, 4) | 53 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo gicv3_cpuif_reginfo[] = { |
48 | + | 54 | .opc0 = 3, .opc1 = 0, .crn = 12, .crm = 12, .opc2 = 7, |
49 | FIELD(ID_DFR0, COPDBG, 0, 4) | 55 | .type = ARM_CP_IO | ARM_CP_NO_RAW, |
50 | FIELD(ID_DFR0, COPSDBG, 4, 4) | 56 | .access = PL1_RW, .accessfn = gicv3_irq_access, |
51 | FIELD(ID_DFR0, MMAPDBG, 8, 4) | 57 | + .fgt = FGT_ICC_IGRPENN_EL1, |
58 | .readfn = icc_igrpen_read, | ||
59 | .writefn = icc_igrpen_write, | ||
60 | }, | ||
52 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 61 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
53 | index XXXXXXX..XXXXXXX 100644 | 62 | index XXXXXXX..XXXXXXX 100644 |
54 | --- a/target/arm/helper.c | 63 | --- a/target/arm/helper.c |
55 | +++ b/target/arm/helper.c | 64 | +++ b/target/arm/helper.c |
65 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo vmsa_cp_reginfo[] = { | ||
66 | { .name = "TTBR0_EL1", .state = ARM_CP_STATE_BOTH, | ||
67 | .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 0, .opc2 = 0, | ||
68 | .access = PL1_RW, .accessfn = access_tvm_trvm, | ||
69 | + .fgt = FGT_TTBR0_EL1, | ||
70 | .writefn = vmsa_ttbr_write, .resetvalue = 0, | ||
71 | .bank_fieldoffsets = { offsetof(CPUARMState, cp15.ttbr0_s), | ||
72 | offsetof(CPUARMState, cp15.ttbr0_ns) } }, | ||
73 | { .name = "TTBR1_EL1", .state = ARM_CP_STATE_BOTH, | ||
74 | .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 0, .opc2 = 1, | ||
75 | .access = PL1_RW, .accessfn = access_tvm_trvm, | ||
76 | + .fgt = FGT_TTBR1_EL1, | ||
77 | .writefn = vmsa_ttbr_write, .resetvalue = 0, | ||
78 | .bank_fieldoffsets = { offsetof(CPUARMState, cp15.ttbr1_s), | ||
79 | offsetof(CPUARMState, cp15.ttbr1_ns) } }, | ||
80 | @@ -XXX,XX +XXX,XX @@ static void disr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t val) | ||
81 | * ERRSELR_EL1 | ||
82 | * may generate UNDEFINED, which is the effect we get by not | ||
83 | * listing them at all. | ||
84 | + * | ||
85 | + * These registers have fine-grained trap bits, but UNDEF-to-EL1 | ||
86 | + * is higher priority than FGT-to-EL2 so we do not need to list them | ||
87 | + * in order to check for an FGT. | ||
88 | */ | ||
89 | static const ARMCPRegInfo minimal_ras_reginfo[] = { | ||
90 | { .name = "DISR_EL1", .state = ARM_CP_STATE_BOTH, | ||
91 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo minimal_ras_reginfo[] = { | ||
92 | { .name = "ERRIDR_EL1", .state = ARM_CP_STATE_BOTH, | ||
93 | .opc0 = 3, .opc1 = 0, .crn = 5, .crm = 3, .opc2 = 0, | ||
94 | .access = PL1_R, .accessfn = access_terr, | ||
95 | + .fgt = FGT_ERRIDR_EL1, | ||
96 | .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
97 | { .name = "VDISR_EL2", .state = ARM_CP_STATE_BOTH, | ||
98 | .opc0 = 3, .opc1 = 4, .crn = 12, .crm = 1, .opc2 = 1, | ||
99 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo sme_reginfo[] = { | ||
100 | { .name = "TPIDR2_EL0", .state = ARM_CP_STATE_AA64, | ||
101 | .opc0 = 3, .opc1 = 3, .crn = 13, .crm = 0, .opc2 = 5, | ||
102 | .access = PL0_RW, .accessfn = access_tpidr2, | ||
103 | + .fgt = FGT_NTPIDR2_EL0, | ||
104 | .fieldoffset = offsetof(CPUARMState, cp15.tpidr2_el0) }, | ||
105 | { .name = "SVCR", .state = ARM_CP_STATE_AA64, | ||
106 | .opc0 = 3, .opc1 = 3, .crn = 4, .crm = 2, .opc2 = 2, | ||
107 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo sme_reginfo[] = { | ||
108 | { .name = "SMPRI_EL1", .state = ARM_CP_STATE_AA64, | ||
109 | .opc0 = 3, .opc1 = 0, .crn = 1, .crm = 2, .opc2 = 4, | ||
110 | .access = PL1_RW, .accessfn = access_esm, | ||
111 | + .fgt = FGT_NSMPRI_EL1, | ||
112 | .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
113 | { .name = "SMPRIMAP_EL2", .state = ARM_CP_STATE_AA64, | ||
114 | .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 2, .opc2 = 5, | ||
56 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | 115 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) |
57 | .access = PL1_R, .type = ARM_CP_CONST, | 116 | { .name = "VBAR", .state = ARM_CP_STATE_BOTH, |
58 | .accessfn = access_aa64_tid3, | 117 | .opc0 = 3, .crn = 12, .crm = 0, .opc1 = 0, .opc2 = 0, |
59 | .resetvalue = cpu->isar.id_aa64mmfr1 }, | 118 | .access = PL1_RW, .writefn = vbar_write, |
60 | - { .name = "ID_AA64MMFR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | 119 | + .fgt = FGT_VBAR_EL1, |
61 | + { .name = "ID_AA64MMFR2_EL1", .state = ARM_CP_STATE_AA64, | 120 | .bank_fieldoffsets = { offsetof(CPUARMState, cp15.vbar_s), |
62 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 2, | 121 | offsetof(CPUARMState, cp15.vbar_ns) }, |
63 | .access = PL1_R, .type = ARM_CP_CONST, | 122 | .resetvalue = 0 }, |
64 | .accessfn = access_aa64_tid3, | ||
65 | - .resetvalue = 0 }, | ||
66 | + .resetvalue = cpu->isar.id_aa64mmfr2 }, | ||
67 | { .name = "ID_AA64MMFR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
68 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 3, | ||
69 | .access = PL1_R, .type = ARM_CP_CONST, | ||
70 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c | ||
71 | index XXXXXXX..XXXXXXX 100644 | ||
72 | --- a/target/arm/kvm64.c | ||
73 | +++ b/target/arm/kvm64.c | ||
74 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) | ||
75 | ARM64_SYS_REG(3, 0, 0, 7, 0)); | ||
76 | err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64mmfr1, | ||
77 | ARM64_SYS_REG(3, 0, 0, 7, 1)); | ||
78 | + err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64mmfr2, | ||
79 | + ARM64_SYS_REG(3, 0, 0, 7, 2)); | ||
80 | |||
81 | /* | ||
82 | * Note that if AArch32 support is not present in the host, | ||
83 | -- | 123 | -- |
84 | 2.20.1 | 124 | 2.34.1 |
85 | |||
86 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | Mark up the sysreg definitons for the registers trapped |
---|---|---|---|
2 | by HDFGRTR/HDFGWTR bits 0..11. These cover various debug | ||
3 | related registers. | ||
2 | 4 | ||
3 | We want to have a common class_init(). The only value that | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | matters (and changes) is the board revision. | 6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
5 | Pass the board_rev as class_data to class_init(). | 7 | Tested-by: Fuad Tabba <tabba@google.com> |
8 | Message-id: 20230130182459.3309057-15-peter.maydell@linaro.org | ||
9 | Message-id: 20230127175507.2895013-15-peter.maydell@linaro.org | ||
10 | --- | ||
11 | target/arm/cpregs.h | 12 ++++++++++++ | ||
12 | target/arm/debug_helper.c | 11 +++++++++++ | ||
13 | 2 files changed, 23 insertions(+) | ||
6 | 14 | ||
7 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 15 | diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h |
8 | Message-id: 20200208165645.15657-9-f4bug@amsat.org | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | hw/arm/raspi.c | 17 ++++++++++++++--- | ||
13 | 1 file changed, 14 insertions(+), 3 deletions(-) | ||
14 | |||
15 | diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/raspi.c | 17 | --- a/target/arm/cpregs.h |
18 | +++ b/hw/arm/raspi.c | 18 | +++ b/target/arm/cpregs.h |
19 | @@ -XXX,XX +XXX,XX @@ typedef struct RaspiMachineClass { | 19 | @@ -XXX,XX +XXX,XX @@ typedef enum FGTBit { |
20 | /*< private >*/ | 20 | DO_BIT(HFGRTR, ERRIDR_EL1), |
21 | MachineClass parent_obj; | 21 | DO_REV_BIT(HFGRTR, NSMPRI_EL1), |
22 | /*< public >*/ | 22 | DO_REV_BIT(HFGRTR, NTPIDR2_EL0), |
23 | + uint32_t board_rev; | 23 | + |
24 | } RaspiMachineClass; | 24 | + /* Trap bits in HDFGRTR_EL2 / HDFGWTR_EL2, starting from bit 0. */ |
25 | 25 | + DO_BIT(HDFGRTR, DBGBCRN_EL1), | |
26 | #define TYPE_RASPI_MACHINE MACHINE_TYPE_NAME("raspi-common") | 26 | + DO_BIT(HDFGRTR, DBGBVRN_EL1), |
27 | @@ -XXX,XX +XXX,XX @@ static void setup_boot(MachineState *machine, int version, size_t ram_size) | 27 | + DO_BIT(HDFGRTR, DBGWCRN_EL1), |
28 | arm_load_kernel(ARM_CPU(first_cpu), machine, &binfo); | 28 | + DO_BIT(HDFGRTR, DBGWVRN_EL1), |
29 | } | 29 | + DO_BIT(HDFGRTR, MDSCR_EL1), |
30 | 30 | + DO_BIT(HDFGRTR, DBGCLAIM), | |
31 | -static void raspi_init(MachineState *machine, uint32_t board_rev) | 31 | + DO_BIT(HDFGWTR, OSLAR_EL1), |
32 | +static void raspi_init(MachineState *machine) | 32 | + DO_BIT(HDFGRTR, OSLSR_EL1), |
33 | { | 33 | + DO_BIT(HDFGRTR, OSECCR_EL1), |
34 | + RaspiMachineClass *mc = RASPI_MACHINE_GET_CLASS(machine); | 34 | + DO_BIT(HDFGRTR, OSDLR_EL1), |
35 | RaspiMachineState *s = RASPI_MACHINE(machine); | 35 | } FGTBit; |
36 | + uint32_t board_rev = mc->board_rev; | 36 | |
37 | int version = board_version(board_rev); | 37 | #undef DO_BIT |
38 | uint64_t ram_size = board_ram_size(board_rev); | 38 | diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c |
39 | uint32_t vcram_size; | 39 | index XXXXXXX..XXXXXXX 100644 |
40 | @@ -XXX,XX +XXX,XX @@ static void raspi_init(MachineState *machine, uint32_t board_rev) | 40 | --- a/target/arm/debug_helper.c |
41 | 41 | +++ b/target/arm/debug_helper.c | |
42 | static void raspi2_init(MachineState *machine) | 42 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo debug_cp_reginfo[] = { |
43 | { | 43 | { .name = "MDSCR_EL1", .state = ARM_CP_STATE_BOTH, |
44 | - raspi_init(machine, 0xa21041); | 44 | .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 2, |
45 | + raspi_init(machine); | 45 | .access = PL1_RW, .accessfn = access_tda, |
46 | } | 46 | + .fgt = FGT_MDSCR_EL1, |
47 | 47 | .fieldoffset = offsetof(CPUARMState, cp15.mdscr_el1), | |
48 | static void raspi2_machine_class_init(ObjectClass *oc, void *data) | 48 | .resetvalue = 0 }, |
49 | { | 49 | /* |
50 | MachineClass *mc = MACHINE_CLASS(oc); | 50 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo debug_cp_reginfo[] = { |
51 | + RaspiMachineClass *rmc = RASPI_MACHINE_CLASS(oc); | 51 | { .name = "OSECCR_EL1", .state = ARM_CP_STATE_BOTH, .cp = 14, |
52 | + uint32_t board_rev = (uint32_t)(uintptr_t)data; | 52 | .opc0 = 2, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 2, |
53 | 53 | .access = PL1_RW, .accessfn = access_tda, | |
54 | + rmc->board_rev = board_rev; | 54 | + .fgt = FGT_OSECCR_EL1, |
55 | mc->desc = "Raspberry Pi 2B"; | 55 | .type = ARM_CP_CONST, .resetvalue = 0 }, |
56 | mc->init = raspi2_init; | 56 | /* |
57 | mc->block_default_type = IF_SD; | 57 | * DBGDSCRint[15,12,5:2] map to MDSCR_EL1[15,12,5:2]. Map all bits as |
58 | @@ -XXX,XX +XXX,XX @@ static void raspi2_machine_class_init(ObjectClass *oc, void *data) | 58 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo debug_cp_reginfo[] = { |
59 | #ifdef TARGET_AARCH64 | 59 | .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 1, .crm = 0, .opc2 = 4, |
60 | static void raspi3_init(MachineState *machine) | 60 | .access = PL1_W, .type = ARM_CP_NO_RAW, |
61 | { | 61 | .accessfn = access_tdosa, |
62 | - raspi_init(machine, 0xa02082); | 62 | + .fgt = FGT_OSLAR_EL1, |
63 | + raspi_init(machine); | 63 | .writefn = oslar_write }, |
64 | } | 64 | { .name = "OSLSR_EL1", .state = ARM_CP_STATE_BOTH, |
65 | 65 | .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 1, .crm = 1, .opc2 = 4, | |
66 | static void raspi3_machine_class_init(ObjectClass *oc, void *data) | 66 | .access = PL1_R, .resetvalue = 10, |
67 | { | 67 | .accessfn = access_tdosa, |
68 | MachineClass *mc = MACHINE_CLASS(oc); | 68 | + .fgt = FGT_OSLSR_EL1, |
69 | + RaspiMachineClass *rmc = RASPI_MACHINE_CLASS(oc); | 69 | .fieldoffset = offsetof(CPUARMState, cp15.oslsr_el1) }, |
70 | + uint32_t board_rev = (uint32_t)(uintptr_t)data; | 70 | /* Dummy OSDLR_EL1: 32-bit Linux will read this */ |
71 | 71 | { .name = "OSDLR_EL1", .state = ARM_CP_STATE_BOTH, | |
72 | + rmc->board_rev = board_rev; | 72 | .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 1, .crm = 3, .opc2 = 4, |
73 | mc->desc = "Raspberry Pi 3B"; | 73 | .access = PL1_RW, .accessfn = access_tdosa, |
74 | mc->init = raspi3_init; | 74 | + .fgt = FGT_OSDLR_EL1, |
75 | mc->block_default_type = IF_SD; | 75 | .writefn = osdlr_write, |
76 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo raspi_machine_types[] = { | 76 | .fieldoffset = offsetof(CPUARMState, cp15.osdlr_el1) }, |
77 | .name = MACHINE_TYPE_NAME("raspi2"), | 77 | /* |
78 | .parent = TYPE_RASPI_MACHINE, | 78 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo debug_cp_reginfo[] = { |
79 | .class_init = raspi2_machine_class_init, | 79 | .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 7, .crm = 8, .opc2 = 6, |
80 | + .class_data = (void *)0xa21041, | 80 | .type = ARM_CP_ALIAS, |
81 | #ifdef TARGET_AARCH64 | 81 | .access = PL1_RW, .accessfn = access_tda, |
82 | }, { | 82 | + .fgt = FGT_DBGCLAIM, |
83 | .name = MACHINE_TYPE_NAME("raspi3"), | 83 | .writefn = dbgclaimset_write, .readfn = dbgclaimset_read }, |
84 | .parent = TYPE_RASPI_MACHINE, | 84 | { .name = "DBGCLAIMCLR_EL1", .state = ARM_CP_STATE_BOTH, |
85 | .class_init = raspi3_machine_class_init, | 85 | .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 7, .crm = 9, .opc2 = 6, |
86 | + .class_data = (void *)0xa02082, | 86 | .access = PL1_RW, .accessfn = access_tda, |
87 | #endif | 87 | + .fgt = FGT_DBGCLAIM, |
88 | }, { | 88 | .writefn = dbgclaimclr_write, .raw_writefn = raw_write, |
89 | .name = TYPE_RASPI_MACHINE, | 89 | .fieldoffset = offsetof(CPUARMState, cp15.dbgclaim) }, |
90 | }; | ||
91 | @@ -XXX,XX +XXX,XX @@ void define_debug_regs(ARMCPU *cpu) | ||
92 | { .name = dbgbvr_el1_name, .state = ARM_CP_STATE_BOTH, | ||
93 | .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 0, .crm = i, .opc2 = 4, | ||
94 | .access = PL1_RW, .accessfn = access_tda, | ||
95 | + .fgt = FGT_DBGBVRN_EL1, | ||
96 | .fieldoffset = offsetof(CPUARMState, cp15.dbgbvr[i]), | ||
97 | .writefn = dbgbvr_write, .raw_writefn = raw_write | ||
98 | }, | ||
99 | { .name = dbgbcr_el1_name, .state = ARM_CP_STATE_BOTH, | ||
100 | .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 0, .crm = i, .opc2 = 5, | ||
101 | .access = PL1_RW, .accessfn = access_tda, | ||
102 | + .fgt = FGT_DBGBCRN_EL1, | ||
103 | .fieldoffset = offsetof(CPUARMState, cp15.dbgbcr[i]), | ||
104 | .writefn = dbgbcr_write, .raw_writefn = raw_write | ||
105 | }, | ||
106 | @@ -XXX,XX +XXX,XX @@ void define_debug_regs(ARMCPU *cpu) | ||
107 | { .name = dbgwvr_el1_name, .state = ARM_CP_STATE_BOTH, | ||
108 | .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 0, .crm = i, .opc2 = 6, | ||
109 | .access = PL1_RW, .accessfn = access_tda, | ||
110 | + .fgt = FGT_DBGWVRN_EL1, | ||
111 | .fieldoffset = offsetof(CPUARMState, cp15.dbgwvr[i]), | ||
112 | .writefn = dbgwvr_write, .raw_writefn = raw_write | ||
113 | }, | ||
114 | { .name = dbgwcr_el1_name, .state = ARM_CP_STATE_BOTH, | ||
115 | .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 0, .crm = i, .opc2 = 7, | ||
116 | .access = PL1_RW, .accessfn = access_tda, | ||
117 | + .fgt = FGT_DBGWCRN_EL1, | ||
118 | .fieldoffset = offsetof(CPUARMState, cp15.dbgwcr[i]), | ||
119 | .writefn = dbgwcr_write, .raw_writefn = raw_write | ||
120 | }, | ||
90 | -- | 121 | -- |
91 | 2.20.1 | 122 | 2.34.1 |
92 | |||
93 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | Mark up the sysreg definitions for the registers trapped |
---|---|---|---|
2 | 2 | by HDFGRTR/HDFGWTR bits 12..x. | |
3 | The PAN bit is preserved, or set as per SCTLR_ELx.SPAN, | 3 | |
4 | plus several other conditions listed in the ARM ARM. | 4 | Bits 12..22 and bit 58 are for PMU registers. |
5 | 5 | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | The remaining bits in HDFGRTR/HDFGWTR are for traps on |
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 7 | registers that are part of features we don't implement: |
8 | Message-id: 20200208125816.14954-15-richard.henderson@linaro.org | 8 | |
9 | Bits 23..32 and 63 : FEAT_SPE | ||
10 | Bits 33..48 : FEAT_ETE | ||
11 | Bits 50..56 : FEAT_TRBE | ||
12 | Bits 59..61 : FEAT_BRBE | ||
13 | Bit 62 : FEAT_SPEv1p2. | ||
14 | |||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
17 | Tested-by: Fuad Tabba <tabba@google.com> | ||
18 | Message-id: 20230130182459.3309057-16-peter.maydell@linaro.org | ||
19 | Message-id: 20230127175507.2895013-16-peter.maydell@linaro.org | ||
10 | --- | 20 | --- |
11 | target/arm/helper.c | 53 ++++++++++++++++++++++++++++++++++++++++++--- | 21 | target/arm/cpregs.h | 12 ++++++++++++ |
12 | 1 file changed, 50 insertions(+), 3 deletions(-) | 22 | target/arm/helper.c | 37 +++++++++++++++++++++++++++++++++++++ |
13 | 23 | 2 files changed, 49 insertions(+) | |
24 | |||
25 | diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h | ||
26 | index XXXXXXX..XXXXXXX 100644 | ||
27 | --- a/target/arm/cpregs.h | ||
28 | +++ b/target/arm/cpregs.h | ||
29 | @@ -XXX,XX +XXX,XX @@ typedef enum FGTBit { | ||
30 | DO_BIT(HDFGRTR, OSLSR_EL1), | ||
31 | DO_BIT(HDFGRTR, OSECCR_EL1), | ||
32 | DO_BIT(HDFGRTR, OSDLR_EL1), | ||
33 | + DO_BIT(HDFGRTR, PMEVCNTRN_EL0), | ||
34 | + DO_BIT(HDFGRTR, PMEVTYPERN_EL0), | ||
35 | + DO_BIT(HDFGRTR, PMCCFILTR_EL0), | ||
36 | + DO_BIT(HDFGRTR, PMCCNTR_EL0), | ||
37 | + DO_BIT(HDFGRTR, PMCNTEN), | ||
38 | + DO_BIT(HDFGRTR, PMINTEN), | ||
39 | + DO_BIT(HDFGRTR, PMOVS), | ||
40 | + DO_BIT(HDFGRTR, PMSELR_EL0), | ||
41 | + DO_BIT(HDFGWTR, PMSWINC_EL0), | ||
42 | + DO_BIT(HDFGWTR, PMCR_EL0), | ||
43 | + DO_BIT(HDFGRTR, PMMIR_EL1), | ||
44 | + DO_BIT(HDFGRTR, PMCEIDN_EL0), | ||
45 | } FGTBit; | ||
46 | |||
47 | #undef DO_BIT | ||
14 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 48 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
15 | index XXXXXXX..XXXXXXX 100644 | 49 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/helper.c | 50 | --- a/target/arm/helper.c |
17 | +++ b/target/arm/helper.c | 51 | +++ b/target/arm/helper.c |
18 | @@ -XXX,XX +XXX,XX @@ static void take_aarch32_exception(CPUARMState *env, int new_mode, | 52 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = { |
19 | uint32_t mask, uint32_t offset, | 53 | .fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pmcnten), |
20 | uint32_t newpc) | 54 | .writefn = pmcntenset_write, |
21 | { | 55 | .accessfn = pmreg_access, |
22 | + int new_el; | 56 | + .fgt = FGT_PMCNTEN, |
23 | + | 57 | .raw_writefn = raw_write }, |
24 | /* Change the CPU state so as to actually take the exception. */ | 58 | { .name = "PMCNTENSET_EL0", .state = ARM_CP_STATE_AA64, .type = ARM_CP_IO, |
25 | switch_mode(env, new_mode); | 59 | .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 12, .opc2 = 1, |
26 | + new_el = arm_current_el(env); | 60 | .access = PL0_RW, .accessfn = pmreg_access, |
27 | + | 61 | + .fgt = FGT_PMCNTEN, |
28 | /* | 62 | .fieldoffset = offsetof(CPUARMState, cp15.c9_pmcnten), .resetvalue = 0, |
29 | * For exceptions taken to AArch32 we must clear the SS bit in both | 63 | .writefn = pmcntenset_write, .raw_writefn = raw_write }, |
30 | * PSTATE and in the old-state value we save to SPSR_<mode>, so zero it now. | 64 | { .name = "PMCNTENCLR", .cp = 15, .crn = 9, .crm = 12, .opc1 = 0, .opc2 = 2, |
31 | @@ -XXX,XX +XXX,XX @@ static void take_aarch32_exception(CPUARMState *env, int new_mode, | 65 | .access = PL0_RW, |
32 | env->uncached_cpsr = (env->uncached_cpsr & ~CPSR_M) | new_mode; | 66 | .fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pmcnten), |
33 | /* Set new mode endianness */ | 67 | .accessfn = pmreg_access, |
34 | env->uncached_cpsr &= ~CPSR_E; | 68 | + .fgt = FGT_PMCNTEN, |
35 | - if (env->cp15.sctlr_el[arm_current_el(env)] & SCTLR_EE) { | 69 | .writefn = pmcntenclr_write, |
36 | + if (env->cp15.sctlr_el[new_el] & SCTLR_EE) { | 70 | .type = ARM_CP_ALIAS | ARM_CP_IO }, |
37 | env->uncached_cpsr |= CPSR_E; | 71 | { .name = "PMCNTENCLR_EL0", .state = ARM_CP_STATE_AA64, |
38 | } | 72 | .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 12, .opc2 = 2, |
39 | /* J and IL must always be cleared for exception entry */ | 73 | .access = PL0_RW, .accessfn = pmreg_access, |
40 | @@ -XXX,XX +XXX,XX @@ static void take_aarch32_exception(CPUARMState *env, int new_mode, | 74 | + .fgt = FGT_PMCNTEN, |
41 | env->thumb = (env->cp15.sctlr_el[2] & SCTLR_TE) != 0; | 75 | .type = ARM_CP_ALIAS | ARM_CP_IO, |
42 | env->elr_el[2] = env->regs[15]; | 76 | .fieldoffset = offsetof(CPUARMState, cp15.c9_pmcnten), |
43 | } else { | 77 | .writefn = pmcntenclr_write }, |
44 | + /* CPSR.PAN is normally preserved preserved unless... */ | 78 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = { |
45 | + if (cpu_isar_feature(aa64_pan, env_archcpu(env))) { | 79 | .access = PL0_RW, .type = ARM_CP_IO, |
46 | + switch (new_el) { | 80 | .fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pmovsr), |
47 | + case 3: | 81 | .accessfn = pmreg_access, |
48 | + if (!arm_is_secure_below_el3(env)) { | 82 | + .fgt = FGT_PMOVS, |
49 | + /* ... the target is EL3, from non-secure state. */ | 83 | .writefn = pmovsr_write, |
50 | + env->uncached_cpsr &= ~CPSR_PAN; | 84 | .raw_writefn = raw_write }, |
51 | + break; | 85 | { .name = "PMOVSCLR_EL0", .state = ARM_CP_STATE_AA64, |
52 | + } | 86 | .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 12, .opc2 = 3, |
53 | + /* ... the target is EL3, from secure state ... */ | 87 | .access = PL0_RW, .accessfn = pmreg_access, |
54 | + /* fall through */ | 88 | + .fgt = FGT_PMOVS, |
55 | + case 1: | 89 | .type = ARM_CP_ALIAS | ARM_CP_IO, |
56 | + /* ... the target is EL1 and SCTLR.SPAN is 0. */ | 90 | .fieldoffset = offsetof(CPUARMState, cp15.c9_pmovsr), |
57 | + if (!(env->cp15.sctlr_el[new_el] & SCTLR_SPAN)) { | 91 | .writefn = pmovsr_write, |
58 | + env->uncached_cpsr |= CPSR_PAN; | 92 | .raw_writefn = raw_write }, |
59 | + } | 93 | { .name = "PMSWINC", .cp = 15, .crn = 9, .crm = 12, .opc1 = 0, .opc2 = 4, |
60 | + break; | 94 | .access = PL0_W, .accessfn = pmreg_access_swinc, |
61 | + } | 95 | + .fgt = FGT_PMSWINC_EL0, |
62 | + } | 96 | .type = ARM_CP_NO_RAW | ARM_CP_IO, |
63 | /* | 97 | .writefn = pmswinc_write }, |
64 | * this is a lie, as there was no c1_sys on V4T/V5, but who cares | 98 | { .name = "PMSWINC_EL0", .state = ARM_CP_STATE_AA64, |
65 | * and we should just guard the thumb mode on V4 | 99 | .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 12, .opc2 = 4, |
66 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs) | 100 | .access = PL0_W, .accessfn = pmreg_access_swinc, |
67 | unsigned int new_el = env->exception.target_el; | 101 | + .fgt = FGT_PMSWINC_EL0, |
68 | target_ulong addr = env->cp15.vbar_el[new_el]; | 102 | .type = ARM_CP_NO_RAW | ARM_CP_IO, |
69 | unsigned int new_mode = aarch64_pstate_mode(new_el, true); | 103 | .writefn = pmswinc_write }, |
70 | + unsigned int old_mode; | 104 | { .name = "PMSELR", .cp = 15, .crn = 9, .crm = 12, .opc1 = 0, .opc2 = 5, |
71 | unsigned int cur_el = arm_current_el(env); | 105 | .access = PL0_RW, .type = ARM_CP_ALIAS, |
72 | 106 | + .fgt = FGT_PMSELR_EL0, | |
73 | /* | 107 | .fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pmselr), |
74 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs) | 108 | .accessfn = pmreg_access_selr, .writefn = pmselr_write, |
75 | } | 109 | .raw_writefn = raw_write}, |
76 | 110 | { .name = "PMSELR_EL0", .state = ARM_CP_STATE_AA64, | |
77 | if (is_a64(env)) { | 111 | .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 12, .opc2 = 5, |
78 | - env->banked_spsr[aarch64_banked_spsr_index(new_el)] = pstate_read(env); | 112 | .access = PL0_RW, .accessfn = pmreg_access_selr, |
79 | + old_mode = pstate_read(env); | 113 | + .fgt = FGT_PMSELR_EL0, |
80 | aarch64_save_sp(env, arm_current_el(env)); | 114 | .fieldoffset = offsetof(CPUARMState, cp15.c9_pmselr), |
81 | env->elr_el[new_el] = env->pc; | 115 | .writefn = pmselr_write, .raw_writefn = raw_write, }, |
82 | } else { | 116 | { .name = "PMCCNTR", .cp = 15, .crn = 9, .crm = 13, .opc1 = 0, .opc2 = 0, |
83 | - env->banked_spsr[aarch64_banked_spsr_index(new_el)] = cpsr_read(env); | 117 | .access = PL0_RW, .resetvalue = 0, .type = ARM_CP_ALIAS | ARM_CP_IO, |
84 | + old_mode = cpsr_read(env); | 118 | + .fgt = FGT_PMCCNTR_EL0, |
85 | env->elr_el[new_el] = env->regs[15]; | 119 | .readfn = pmccntr_read, .writefn = pmccntr_write32, |
86 | 120 | .accessfn = pmreg_access_ccntr }, | |
87 | aarch64_sync_32_to_64(env); | 121 | { .name = "PMCCNTR_EL0", .state = ARM_CP_STATE_AA64, |
88 | 122 | .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 13, .opc2 = 0, | |
89 | env->condexec_bits = 0; | 123 | .access = PL0_RW, .accessfn = pmreg_access_ccntr, |
90 | } | 124 | + .fgt = FGT_PMCCNTR_EL0, |
91 | + env->banked_spsr[aarch64_banked_spsr_index(new_el)] = old_mode; | 125 | .type = ARM_CP_IO, |
92 | + | 126 | .fieldoffset = offsetof(CPUARMState, cp15.c15_ccnt), |
93 | qemu_log_mask(CPU_LOG_INT, "...with ELR 0x%" PRIx64 "\n", | 127 | .readfn = pmccntr_read, .writefn = pmccntr_write, |
94 | env->elr_el[new_el]); | 128 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = { |
95 | 129 | { .name = "PMCCFILTR", .cp = 15, .opc1 = 0, .crn = 14, .crm = 15, .opc2 = 7, | |
96 | + if (cpu_isar_feature(aa64_pan, cpu)) { | 130 | .writefn = pmccfiltr_write_a32, .readfn = pmccfiltr_read_a32, |
97 | + /* The value of PSTATE.PAN is normally preserved, except when ... */ | 131 | .access = PL0_RW, .accessfn = pmreg_access, |
98 | + new_mode |= old_mode & PSTATE_PAN; | 132 | + .fgt = FGT_PMCCFILTR_EL0, |
99 | + switch (new_el) { | 133 | .type = ARM_CP_ALIAS | ARM_CP_IO, |
100 | + case 2: | 134 | .resetvalue = 0, }, |
101 | + /* ... the target is EL2 with HCR_EL2.{E2H,TGE} == '11' ... */ | 135 | { .name = "PMCCFILTR_EL0", .state = ARM_CP_STATE_AA64, |
102 | + if ((arm_hcr_el2_eff(env) & (HCR_E2H | HCR_TGE)) | 136 | .opc0 = 3, .opc1 = 3, .crn = 14, .crm = 15, .opc2 = 7, |
103 | + != (HCR_E2H | HCR_TGE)) { | 137 | .writefn = pmccfiltr_write, .raw_writefn = raw_write, |
104 | + break; | 138 | .access = PL0_RW, .accessfn = pmreg_access, |
105 | + } | 139 | + .fgt = FGT_PMCCFILTR_EL0, |
106 | + /* fall through */ | 140 | .type = ARM_CP_IO, |
107 | + case 1: | 141 | .fieldoffset = offsetof(CPUARMState, cp15.pmccfiltr_el0), |
108 | + /* ... the target is EL1 ... */ | 142 | .resetvalue = 0, }, |
109 | + /* ... and SCTLR_ELx.SPAN == 0, then set to 1. */ | 143 | { .name = "PMXEVTYPER", .cp = 15, .crn = 9, .crm = 13, .opc1 = 0, .opc2 = 1, |
110 | + if ((env->cp15.sctlr_el[new_el] & SCTLR_SPAN) == 0) { | 144 | .access = PL0_RW, .type = ARM_CP_NO_RAW | ARM_CP_IO, |
111 | + new_mode |= PSTATE_PAN; | 145 | .accessfn = pmreg_access, |
112 | + } | 146 | + .fgt = FGT_PMEVTYPERN_EL0, |
113 | + break; | 147 | .writefn = pmxevtyper_write, .readfn = pmxevtyper_read }, |
114 | + } | 148 | { .name = "PMXEVTYPER_EL0", .state = ARM_CP_STATE_AA64, |
115 | + } | 149 | .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 13, .opc2 = 1, |
116 | + | 150 | .access = PL0_RW, .type = ARM_CP_NO_RAW | ARM_CP_IO, |
117 | pstate_write(env, PSTATE_DAIF | new_mode); | 151 | .accessfn = pmreg_access, |
118 | env->aarch64 = 1; | 152 | + .fgt = FGT_PMEVTYPERN_EL0, |
119 | aarch64_restore_sp(env, new_el); | 153 | .writefn = pmxevtyper_write, .readfn = pmxevtyper_read }, |
154 | { .name = "PMXEVCNTR", .cp = 15, .crn = 9, .crm = 13, .opc1 = 0, .opc2 = 2, | ||
155 | .access = PL0_RW, .type = ARM_CP_NO_RAW | ARM_CP_IO, | ||
156 | .accessfn = pmreg_access_xevcntr, | ||
157 | + .fgt = FGT_PMEVCNTRN_EL0, | ||
158 | .writefn = pmxevcntr_write, .readfn = pmxevcntr_read }, | ||
159 | { .name = "PMXEVCNTR_EL0", .state = ARM_CP_STATE_AA64, | ||
160 | .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 13, .opc2 = 2, | ||
161 | .access = PL0_RW, .type = ARM_CP_NO_RAW | ARM_CP_IO, | ||
162 | .accessfn = pmreg_access_xevcntr, | ||
163 | + .fgt = FGT_PMEVCNTRN_EL0, | ||
164 | .writefn = pmxevcntr_write, .readfn = pmxevcntr_read }, | ||
165 | { .name = "PMUSERENR", .cp = 15, .crn = 9, .crm = 14, .opc1 = 0, .opc2 = 0, | ||
166 | .access = PL0_R | PL1_RW, .accessfn = access_tpm, | ||
167 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = { | ||
168 | .writefn = pmuserenr_write, .raw_writefn = raw_write }, | ||
169 | { .name = "PMINTENSET", .cp = 15, .crn = 9, .crm = 14, .opc1 = 0, .opc2 = 1, | ||
170 | .access = PL1_RW, .accessfn = access_tpm, | ||
171 | + .fgt = FGT_PMINTEN, | ||
172 | .type = ARM_CP_ALIAS | ARM_CP_IO, | ||
173 | .fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pminten), | ||
174 | .resetvalue = 0, | ||
175 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = { | ||
176 | { .name = "PMINTENSET_EL1", .state = ARM_CP_STATE_AA64, | ||
177 | .opc0 = 3, .opc1 = 0, .crn = 9, .crm = 14, .opc2 = 1, | ||
178 | .access = PL1_RW, .accessfn = access_tpm, | ||
179 | + .fgt = FGT_PMINTEN, | ||
180 | .type = ARM_CP_IO, | ||
181 | .fieldoffset = offsetof(CPUARMState, cp15.c9_pminten), | ||
182 | .writefn = pmintenset_write, .raw_writefn = raw_write, | ||
183 | .resetvalue = 0x0 }, | ||
184 | { .name = "PMINTENCLR", .cp = 15, .crn = 9, .crm = 14, .opc1 = 0, .opc2 = 2, | ||
185 | .access = PL1_RW, .accessfn = access_tpm, | ||
186 | + .fgt = FGT_PMINTEN, | ||
187 | .type = ARM_CP_ALIAS | ARM_CP_IO | ARM_CP_NO_RAW, | ||
188 | .fieldoffset = offsetof(CPUARMState, cp15.c9_pminten), | ||
189 | .writefn = pmintenclr_write, }, | ||
190 | { .name = "PMINTENCLR_EL1", .state = ARM_CP_STATE_AA64, | ||
191 | .opc0 = 3, .opc1 = 0, .crn = 9, .crm = 14, .opc2 = 2, | ||
192 | .access = PL1_RW, .accessfn = access_tpm, | ||
193 | + .fgt = FGT_PMINTEN, | ||
194 | .type = ARM_CP_ALIAS | ARM_CP_IO | ARM_CP_NO_RAW, | ||
195 | .fieldoffset = offsetof(CPUARMState, cp15.c9_pminten), | ||
196 | .writefn = pmintenclr_write }, | ||
197 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo pmovsset_cp_reginfo[] = { | ||
198 | /* PMOVSSET is not implemented in v7 before v7ve */ | ||
199 | { .name = "PMOVSSET", .cp = 15, .opc1 = 0, .crn = 9, .crm = 14, .opc2 = 3, | ||
200 | .access = PL0_RW, .accessfn = pmreg_access, | ||
201 | + .fgt = FGT_PMOVS, | ||
202 | .type = ARM_CP_ALIAS | ARM_CP_IO, | ||
203 | .fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pmovsr), | ||
204 | .writefn = pmovsset_write, | ||
205 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo pmovsset_cp_reginfo[] = { | ||
206 | { .name = "PMOVSSET_EL0", .state = ARM_CP_STATE_AA64, | ||
207 | .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 14, .opc2 = 3, | ||
208 | .access = PL0_RW, .accessfn = pmreg_access, | ||
209 | + .fgt = FGT_PMOVS, | ||
210 | .type = ARM_CP_ALIAS | ARM_CP_IO, | ||
211 | .fieldoffset = offsetof(CPUARMState, cp15.c9_pmovsr), | ||
212 | .writefn = pmovsset_write, | ||
213 | @@ -XXX,XX +XXX,XX @@ static void define_pmu_regs(ARMCPU *cpu) | ||
214 | ARMCPRegInfo pmcr = { | ||
215 | .name = "PMCR", .cp = 15, .crn = 9, .crm = 12, .opc1 = 0, .opc2 = 0, | ||
216 | .access = PL0_RW, | ||
217 | + .fgt = FGT_PMCR_EL0, | ||
218 | .type = ARM_CP_IO | ARM_CP_ALIAS, | ||
219 | .fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pmcr), | ||
220 | .accessfn = pmreg_access, .writefn = pmcr_write, | ||
221 | @@ -XXX,XX +XXX,XX @@ static void define_pmu_regs(ARMCPU *cpu) | ||
222 | .name = "PMCR_EL0", .state = ARM_CP_STATE_AA64, | ||
223 | .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 12, .opc2 = 0, | ||
224 | .access = PL0_RW, .accessfn = pmreg_access, | ||
225 | + .fgt = FGT_PMCR_EL0, | ||
226 | .type = ARM_CP_IO, | ||
227 | .fieldoffset = offsetof(CPUARMState, cp15.c9_pmcr), | ||
228 | .resetvalue = cpu->isar.reset_pmcr_el0, | ||
229 | @@ -XXX,XX +XXX,XX @@ static void define_pmu_regs(ARMCPU *cpu) | ||
230 | { .name = pmevcntr_name, .cp = 15, .crn = 14, | ||
231 | .crm = 8 | (3 & (i >> 3)), .opc1 = 0, .opc2 = i & 7, | ||
232 | .access = PL0_RW, .type = ARM_CP_IO | ARM_CP_ALIAS, | ||
233 | + .fgt = FGT_PMEVCNTRN_EL0, | ||
234 | .readfn = pmevcntr_readfn, .writefn = pmevcntr_writefn, | ||
235 | .accessfn = pmreg_access_xevcntr }, | ||
236 | { .name = pmevcntr_el0_name, .state = ARM_CP_STATE_AA64, | ||
237 | .opc0 = 3, .opc1 = 3, .crn = 14, .crm = 8 | (3 & (i >> 3)), | ||
238 | .opc2 = i & 7, .access = PL0_RW, .accessfn = pmreg_access_xevcntr, | ||
239 | .type = ARM_CP_IO, | ||
240 | + .fgt = FGT_PMEVCNTRN_EL0, | ||
241 | .readfn = pmevcntr_readfn, .writefn = pmevcntr_writefn, | ||
242 | .raw_readfn = pmevcntr_rawread, | ||
243 | .raw_writefn = pmevcntr_rawwrite }, | ||
244 | { .name = pmevtyper_name, .cp = 15, .crn = 14, | ||
245 | .crm = 12 | (3 & (i >> 3)), .opc1 = 0, .opc2 = i & 7, | ||
246 | .access = PL0_RW, .type = ARM_CP_IO | ARM_CP_ALIAS, | ||
247 | + .fgt = FGT_PMEVTYPERN_EL0, | ||
248 | .readfn = pmevtyper_readfn, .writefn = pmevtyper_writefn, | ||
249 | .accessfn = pmreg_access }, | ||
250 | { .name = pmevtyper_el0_name, .state = ARM_CP_STATE_AA64, | ||
251 | .opc0 = 3, .opc1 = 3, .crn = 14, .crm = 12 | (3 & (i >> 3)), | ||
252 | .opc2 = i & 7, .access = PL0_RW, .accessfn = pmreg_access, | ||
253 | + .fgt = FGT_PMEVTYPERN_EL0, | ||
254 | .type = ARM_CP_IO, | ||
255 | .readfn = pmevtyper_readfn, .writefn = pmevtyper_writefn, | ||
256 | .raw_writefn = pmevtyper_rawwrite }, | ||
257 | @@ -XXX,XX +XXX,XX @@ static void define_pmu_regs(ARMCPU *cpu) | ||
258 | { .name = "PMCEID2", .state = ARM_CP_STATE_AA32, | ||
259 | .cp = 15, .opc1 = 0, .crn = 9, .crm = 14, .opc2 = 4, | ||
260 | .access = PL0_R, .accessfn = pmreg_access, .type = ARM_CP_CONST, | ||
261 | + .fgt = FGT_PMCEIDN_EL0, | ||
262 | .resetvalue = extract64(cpu->pmceid0, 32, 32) }, | ||
263 | { .name = "PMCEID3", .state = ARM_CP_STATE_AA32, | ||
264 | .cp = 15, .opc1 = 0, .crn = 9, .crm = 14, .opc2 = 5, | ||
265 | .access = PL0_R, .accessfn = pmreg_access, .type = ARM_CP_CONST, | ||
266 | + .fgt = FGT_PMCEIDN_EL0, | ||
267 | .resetvalue = extract64(cpu->pmceid1, 32, 32) }, | ||
268 | }; | ||
269 | define_arm_cp_regs(cpu, v81_pmu_regs); | ||
270 | @@ -XXX,XX +XXX,XX @@ static void define_pmu_regs(ARMCPU *cpu) | ||
271 | .name = "PMMIR_EL1", .state = ARM_CP_STATE_BOTH, | ||
272 | .opc0 = 3, .opc1 = 0, .crn = 9, .crm = 14, .opc2 = 6, | ||
273 | .access = PL1_R, .accessfn = pmreg_access, .type = ARM_CP_CONST, | ||
274 | + .fgt = FGT_PMMIR_EL1, | ||
275 | .resetvalue = 0 | ||
276 | }; | ||
277 | define_one_arm_cp_reg(cpu, &v84_pmmir); | ||
278 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
279 | { .name = "PMCEID0", .state = ARM_CP_STATE_AA32, | ||
280 | .cp = 15, .opc1 = 0, .crn = 9, .crm = 12, .opc2 = 6, | ||
281 | .access = PL0_R, .accessfn = pmreg_access, .type = ARM_CP_CONST, | ||
282 | + .fgt = FGT_PMCEIDN_EL0, | ||
283 | .resetvalue = extract64(cpu->pmceid0, 0, 32) }, | ||
284 | { .name = "PMCEID0_EL0", .state = ARM_CP_STATE_AA64, | ||
285 | .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 12, .opc2 = 6, | ||
286 | .access = PL0_R, .accessfn = pmreg_access, .type = ARM_CP_CONST, | ||
287 | + .fgt = FGT_PMCEIDN_EL0, | ||
288 | .resetvalue = cpu->pmceid0 }, | ||
289 | { .name = "PMCEID1", .state = ARM_CP_STATE_AA32, | ||
290 | .cp = 15, .opc1 = 0, .crn = 9, .crm = 12, .opc2 = 7, | ||
291 | .access = PL0_R, .accessfn = pmreg_access, .type = ARM_CP_CONST, | ||
292 | + .fgt = FGT_PMCEIDN_EL0, | ||
293 | .resetvalue = extract64(cpu->pmceid1, 0, 32) }, | ||
294 | { .name = "PMCEID1_EL0", .state = ARM_CP_STATE_AA64, | ||
295 | .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 12, .opc2 = 7, | ||
296 | .access = PL0_R, .accessfn = pmreg_access, .type = ARM_CP_CONST, | ||
297 | + .fgt = FGT_PMCEIDN_EL0, | ||
298 | .resetvalue = cpu->pmceid1 }, | ||
299 | }; | ||
300 | #ifdef CONFIG_USER_ONLY | ||
120 | -- | 301 | -- |
121 | 2.20.1 | 302 | 2.34.1 |
122 | |||
123 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | Mark up the sysreg definitions for the system instructions |
---|---|---|---|
2 | trapped by HFGITR bits 0..11. These bits cover various | ||
3 | cache maintenance operations. | ||
2 | 4 | ||
3 | Examine the PAN bit for EL1, EL2, and Secure EL1 to | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | determine if it applies. | 6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Tested-by: Fuad Tabba <tabba@google.com> | ||
8 | Message-id: 20230130182459.3309057-17-peter.maydell@linaro.org | ||
9 | Message-id: 20230127175507.2895013-17-peter.maydell@linaro.org | ||
10 | --- | ||
11 | target/arm/cpregs.h | 14 ++++++++++++++ | ||
12 | target/arm/helper.c | 28 ++++++++++++++++++++++++++++ | ||
13 | 2 files changed, 42 insertions(+) | ||
5 | 14 | ||
6 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 15 | diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h |
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 16 | index XXXXXXX..XXXXXXX 100644 |
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 17 | --- a/target/arm/cpregs.h |
9 | Message-id: 20200208125816.14954-13-richard.henderson@linaro.org | 18 | +++ b/target/arm/cpregs.h |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 19 | @@ -XXX,XX +XXX,XX @@ typedef enum FGTBit { |
11 | --- | 20 | DO_BIT(HDFGWTR, PMCR_EL0), |
12 | target/arm/helper.c | 9 +++++++++ | 21 | DO_BIT(HDFGRTR, PMMIR_EL1), |
13 | 1 file changed, 9 insertions(+) | 22 | DO_BIT(HDFGRTR, PMCEIDN_EL0), |
14 | 23 | + | |
24 | + /* Trap bits in HFGITR_EL2, starting from bit 0 */ | ||
25 | + DO_BIT(HFGITR, ICIALLUIS), | ||
26 | + DO_BIT(HFGITR, ICIALLU), | ||
27 | + DO_BIT(HFGITR, ICIVAU), | ||
28 | + DO_BIT(HFGITR, DCIVAC), | ||
29 | + DO_BIT(HFGITR, DCISW), | ||
30 | + DO_BIT(HFGITR, DCCSW), | ||
31 | + DO_BIT(HFGITR, DCCISW), | ||
32 | + DO_BIT(HFGITR, DCCVAU), | ||
33 | + DO_BIT(HFGITR, DCCVAP), | ||
34 | + DO_BIT(HFGITR, DCCVADP), | ||
35 | + DO_BIT(HFGITR, DCCIVAC), | ||
36 | + DO_BIT(HFGITR, DCZVA), | ||
37 | } FGTBit; | ||
38 | |||
39 | #undef DO_BIT | ||
15 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 40 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
16 | index XXXXXXX..XXXXXXX 100644 | 41 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/helper.c | 42 | --- a/target/arm/helper.c |
18 | +++ b/target/arm/helper.c | 43 | +++ b/target/arm/helper.c |
19 | @@ -XXX,XX +XXX,XX @@ ARMMMUIdx arm_mmu_idx_el(CPUARMState *env, int el) | 44 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { |
20 | return ARMMMUIdx_E10_0; | 45 | #ifndef CONFIG_USER_ONLY |
21 | case 1: | 46 | /* Avoid overhead of an access check that always passes in user-mode */ |
22 | if (arm_is_secure_below_el3(env)) { | 47 | .accessfn = aa64_zva_access, |
23 | + if (env->pstate & PSTATE_PAN) { | 48 | + .fgt = FGT_DCZVA, |
24 | + return ARMMMUIdx_SE10_1_PAN; | 49 | #endif |
25 | + } | 50 | }, |
26 | return ARMMMUIdx_SE10_1; | 51 | { .name = "CURRENTEL", .state = ARM_CP_STATE_AA64, |
27 | } | 52 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { |
28 | + if (env->pstate & PSTATE_PAN) { | 53 | { .name = "IC_IALLUIS", .state = ARM_CP_STATE_AA64, |
29 | + return ARMMMUIdx_E10_1_PAN; | 54 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 1, .opc2 = 0, |
30 | + } | 55 | .access = PL1_W, .type = ARM_CP_NOP, |
31 | return ARMMMUIdx_E10_1; | 56 | + .fgt = FGT_ICIALLUIS, |
32 | case 2: | 57 | .accessfn = access_ticab }, |
33 | /* TODO: ARMv8.4-SecEL2 */ | 58 | { .name = "IC_IALLU", .state = ARM_CP_STATE_AA64, |
34 | /* Note that TGE does not apply at EL2. */ | 59 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 5, .opc2 = 0, |
35 | if ((env->cp15.hcr_el2 & HCR_E2H) && arm_el_is_aa64(env, 2)) { | 60 | .access = PL1_W, .type = ARM_CP_NOP, |
36 | + if (env->pstate & PSTATE_PAN) { | 61 | + .fgt = FGT_ICIALLU, |
37 | + return ARMMMUIdx_E20_2_PAN; | 62 | .accessfn = access_tocu }, |
38 | + } | 63 | { .name = "IC_IVAU", .state = ARM_CP_STATE_AA64, |
39 | return ARMMMUIdx_E20_2; | 64 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 5, .opc2 = 1, |
40 | } | 65 | .access = PL0_W, .type = ARM_CP_NOP, |
41 | return ARMMMUIdx_E2; | 66 | + .fgt = FGT_ICIVAU, |
67 | .accessfn = access_tocu }, | ||
68 | { .name = "DC_IVAC", .state = ARM_CP_STATE_AA64, | ||
69 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 1, | ||
70 | .access = PL1_W, .accessfn = aa64_cacheop_poc_access, | ||
71 | + .fgt = FGT_DCIVAC, | ||
72 | .type = ARM_CP_NOP }, | ||
73 | { .name = "DC_ISW", .state = ARM_CP_STATE_AA64, | ||
74 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 2, | ||
75 | + .fgt = FGT_DCISW, | ||
76 | .access = PL1_W, .accessfn = access_tsw, .type = ARM_CP_NOP }, | ||
77 | { .name = "DC_CVAC", .state = ARM_CP_STATE_AA64, | ||
78 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 10, .opc2 = 1, | ||
79 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { | ||
80 | .accessfn = aa64_cacheop_poc_access }, | ||
81 | { .name = "DC_CSW", .state = ARM_CP_STATE_AA64, | ||
82 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 10, .opc2 = 2, | ||
83 | + .fgt = FGT_DCCSW, | ||
84 | .access = PL1_W, .accessfn = access_tsw, .type = ARM_CP_NOP }, | ||
85 | { .name = "DC_CVAU", .state = ARM_CP_STATE_AA64, | ||
86 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 11, .opc2 = 1, | ||
87 | .access = PL0_W, .type = ARM_CP_NOP, | ||
88 | + .fgt = FGT_DCCVAU, | ||
89 | .accessfn = access_tocu }, | ||
90 | { .name = "DC_CIVAC", .state = ARM_CP_STATE_AA64, | ||
91 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 14, .opc2 = 1, | ||
92 | .access = PL0_W, .type = ARM_CP_NOP, | ||
93 | + .fgt = FGT_DCCIVAC, | ||
94 | .accessfn = aa64_cacheop_poc_access }, | ||
95 | { .name = "DC_CISW", .state = ARM_CP_STATE_AA64, | ||
96 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 14, .opc2 = 2, | ||
97 | + .fgt = FGT_DCCISW, | ||
98 | .access = PL1_W, .accessfn = access_tsw, .type = ARM_CP_NOP }, | ||
99 | /* TLBI operations */ | ||
100 | { .name = "TLBI_VMALLE1IS", .state = ARM_CP_STATE_AA64, | ||
101 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo dcpop_reg[] = { | ||
102 | { .name = "DC_CVAP", .state = ARM_CP_STATE_AA64, | ||
103 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 12, .opc2 = 1, | ||
104 | .access = PL0_W, .type = ARM_CP_NO_RAW | ARM_CP_SUPPRESS_TB_END, | ||
105 | + .fgt = FGT_DCCVAP, | ||
106 | .accessfn = aa64_cacheop_poc_access, .writefn = dccvap_writefn }, | ||
107 | }; | ||
108 | |||
109 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo dcpodp_reg[] = { | ||
110 | { .name = "DC_CVADP", .state = ARM_CP_STATE_AA64, | ||
111 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 13, .opc2 = 1, | ||
112 | .access = PL0_W, .type = ARM_CP_NO_RAW | ARM_CP_SUPPRESS_TB_END, | ||
113 | + .fgt = FGT_DCCVADP, | ||
114 | .accessfn = aa64_cacheop_poc_access, .writefn = dccvap_writefn }, | ||
115 | }; | ||
116 | #endif /*CONFIG_USER_ONLY*/ | ||
117 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo mte_reginfo[] = { | ||
118 | { .name = "DC_IGVAC", .state = ARM_CP_STATE_AA64, | ||
119 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 3, | ||
120 | .type = ARM_CP_NOP, .access = PL1_W, | ||
121 | + .fgt = FGT_DCIVAC, | ||
122 | .accessfn = aa64_cacheop_poc_access }, | ||
123 | { .name = "DC_IGSW", .state = ARM_CP_STATE_AA64, | ||
124 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 4, | ||
125 | + .fgt = FGT_DCISW, | ||
126 | .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw }, | ||
127 | { .name = "DC_IGDVAC", .state = ARM_CP_STATE_AA64, | ||
128 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 5, | ||
129 | .type = ARM_CP_NOP, .access = PL1_W, | ||
130 | + .fgt = FGT_DCIVAC, | ||
131 | .accessfn = aa64_cacheop_poc_access }, | ||
132 | { .name = "DC_IGDSW", .state = ARM_CP_STATE_AA64, | ||
133 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 6, | ||
134 | + .fgt = FGT_DCISW, | ||
135 | .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw }, | ||
136 | { .name = "DC_CGSW", .state = ARM_CP_STATE_AA64, | ||
137 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 10, .opc2 = 4, | ||
138 | + .fgt = FGT_DCCSW, | ||
139 | .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw }, | ||
140 | { .name = "DC_CGDSW", .state = ARM_CP_STATE_AA64, | ||
141 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 10, .opc2 = 6, | ||
142 | + .fgt = FGT_DCCSW, | ||
143 | .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw }, | ||
144 | { .name = "DC_CIGSW", .state = ARM_CP_STATE_AA64, | ||
145 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 14, .opc2 = 4, | ||
146 | + .fgt = FGT_DCCISW, | ||
147 | .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw }, | ||
148 | { .name = "DC_CIGDSW", .state = ARM_CP_STATE_AA64, | ||
149 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 14, .opc2 = 6, | ||
150 | + .fgt = FGT_DCCISW, | ||
151 | .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw }, | ||
152 | }; | ||
153 | |||
154 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo mte_el0_cacheop_reginfo[] = { | ||
155 | { .name = "DC_CGVAP", .state = ARM_CP_STATE_AA64, | ||
156 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 12, .opc2 = 3, | ||
157 | .type = ARM_CP_NOP, .access = PL0_W, | ||
158 | + .fgt = FGT_DCCVAP, | ||
159 | .accessfn = aa64_cacheop_poc_access }, | ||
160 | { .name = "DC_CGDVAP", .state = ARM_CP_STATE_AA64, | ||
161 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 12, .opc2 = 5, | ||
162 | .type = ARM_CP_NOP, .access = PL0_W, | ||
163 | + .fgt = FGT_DCCVAP, | ||
164 | .accessfn = aa64_cacheop_poc_access }, | ||
165 | { .name = "DC_CGVADP", .state = ARM_CP_STATE_AA64, | ||
166 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 13, .opc2 = 3, | ||
167 | .type = ARM_CP_NOP, .access = PL0_W, | ||
168 | + .fgt = FGT_DCCVADP, | ||
169 | .accessfn = aa64_cacheop_poc_access }, | ||
170 | { .name = "DC_CGDVADP", .state = ARM_CP_STATE_AA64, | ||
171 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 13, .opc2 = 5, | ||
172 | .type = ARM_CP_NOP, .access = PL0_W, | ||
173 | + .fgt = FGT_DCCVADP, | ||
174 | .accessfn = aa64_cacheop_poc_access }, | ||
175 | { .name = "DC_CIGVAC", .state = ARM_CP_STATE_AA64, | ||
176 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 14, .opc2 = 3, | ||
177 | .type = ARM_CP_NOP, .access = PL0_W, | ||
178 | + .fgt = FGT_DCCIVAC, | ||
179 | .accessfn = aa64_cacheop_poc_access }, | ||
180 | { .name = "DC_CIGDVAC", .state = ARM_CP_STATE_AA64, | ||
181 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 14, .opc2 = 5, | ||
182 | .type = ARM_CP_NOP, .access = PL0_W, | ||
183 | + .fgt = FGT_DCCIVAC, | ||
184 | .accessfn = aa64_cacheop_poc_access }, | ||
185 | { .name = "DC_GVA", .state = ARM_CP_STATE_AA64, | ||
186 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 4, .opc2 = 3, | ||
187 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo mte_el0_cacheop_reginfo[] = { | ||
188 | #ifndef CONFIG_USER_ONLY | ||
189 | /* Avoid overhead of an access check that always passes in user-mode */ | ||
190 | .accessfn = aa64_zva_access, | ||
191 | + .fgt = FGT_DCZVA, | ||
192 | #endif | ||
193 | }, | ||
194 | { .name = "DC_GZVA", .state = ARM_CP_STATE_AA64, | ||
195 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo mte_el0_cacheop_reginfo[] = { | ||
196 | #ifndef CONFIG_USER_ONLY | ||
197 | /* Avoid overhead of an access check that always passes in user-mode */ | ||
198 | .accessfn = aa64_zva_access, | ||
199 | + .fgt = FGT_DCZVA, | ||
200 | #endif | ||
201 | }, | ||
202 | }; | ||
42 | -- | 203 | -- |
43 | 2.20.1 | 204 | 2.34.1 |
44 | |||
45 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | Mark up the sysreg definitions for the system instructions |
---|---|---|---|
2 | trapped by HFGITR bits 12..17. These bits cover AT address | ||
3 | translation instructions. | ||
2 | 4 | ||
3 | The board revision encode the amount of RAM. Add a helper | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | to extract the RAM size, and use it. | 6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
5 | Since the amount of RAM is fixed (it is impossible to physically | 7 | Tested-by: Fuad Tabba <tabba@google.com> |
6 | modify to have more or less RAM), do not allow sizes different | 8 | Message-id: 20230130182459.3309057-18-peter.maydell@linaro.org |
7 | than the one anounced by the manufacturer. | 9 | Message-id: 20230127175507.2895013-18-peter.maydell@linaro.org |
10 | --- | ||
11 | target/arm/cpregs.h | 6 ++++++ | ||
12 | target/arm/helper.c | 6 ++++++ | ||
13 | 2 files changed, 12 insertions(+) | ||
8 | 14 | ||
9 | Acked-by: Igor Mammedov <imammedo@redhat.com> | 15 | diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h |
10 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
11 | Message-id: 20200208165645.15657-5-f4bug@amsat.org | ||
12 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | --- | ||
15 | hw/arm/raspi.c | 15 ++++++++++++--- | ||
16 | 1 file changed, 12 insertions(+), 3 deletions(-) | ||
17 | |||
18 | diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c | ||
19 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/hw/arm/raspi.c | 17 | --- a/target/arm/cpregs.h |
21 | +++ b/hw/arm/raspi.c | 18 | +++ b/target/arm/cpregs.h |
22 | @@ -XXX,XX +XXX,XX @@ | 19 | @@ -XXX,XX +XXX,XX @@ typedef enum FGTBit { |
23 | 20 | DO_BIT(HFGITR, DCCVADP), | |
24 | #include "qemu/osdep.h" | 21 | DO_BIT(HFGITR, DCCIVAC), |
25 | #include "qemu/units.h" | 22 | DO_BIT(HFGITR, DCZVA), |
26 | +#include "qemu/cutils.h" | 23 | + DO_BIT(HFGITR, ATS1E1R), |
27 | #include "qapi/error.h" | 24 | + DO_BIT(HFGITR, ATS1E1W), |
28 | #include "cpu.h" | 25 | + DO_BIT(HFGITR, ATS1E0R), |
29 | #include "hw/arm/bcm2836.h" | 26 | + DO_BIT(HFGITR, ATS1E0W), |
30 | @@ -XXX,XX +XXX,XX @@ FIELD(REV_CODE, MANUFACTURER, 16, 4); | 27 | + DO_BIT(HFGITR, ATS1E1RP), |
31 | FIELD(REV_CODE, MEMORY_SIZE, 20, 3); | 28 | + DO_BIT(HFGITR, ATS1E1WP), |
32 | FIELD(REV_CODE, STYLE, 23, 1); | 29 | } FGTBit; |
33 | 30 | ||
34 | +static uint64_t board_ram_size(uint32_t board_rev) | 31 | #undef DO_BIT |
35 | +{ | 32 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
36 | + assert(FIELD_EX32(board_rev, REV_CODE, STYLE)); /* Only new style */ | 33 | index XXXXXXX..XXXXXXX 100644 |
37 | + return 256 * MiB << FIELD_EX32(board_rev, REV_CODE, MEMORY_SIZE); | 34 | --- a/target/arm/helper.c |
38 | +} | 35 | +++ b/target/arm/helper.c |
39 | + | 36 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { |
40 | static int board_processor_id(uint32_t board_rev) | 37 | { .name = "AT_S1E1R", .state = ARM_CP_STATE_AA64, |
41 | { | 38 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 8, .opc2 = 0, |
42 | assert(FIELD_EX32(board_rev, REV_CODE, STYLE)); /* Only new style */ | 39 | .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, |
43 | @@ -XXX,XX +XXX,XX @@ static void raspi_init(MachineState *machine, uint32_t board_rev) | 40 | + .fgt = FGT_ATS1E1R, |
44 | { | 41 | .writefn = ats_write64 }, |
45 | RasPiState *s = g_new0(RasPiState, 1); | 42 | { .name = "AT_S1E1W", .state = ARM_CP_STATE_AA64, |
46 | int version = board_version(board_rev); | 43 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 8, .opc2 = 1, |
47 | + uint64_t ram_size = board_ram_size(board_rev); | 44 | .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, |
48 | uint32_t vcram_size; | 45 | + .fgt = FGT_ATS1E1W, |
49 | DriveInfo *di; | 46 | .writefn = ats_write64 }, |
50 | BlockBackend *blk; | 47 | { .name = "AT_S1E0R", .state = ARM_CP_STATE_AA64, |
51 | BusState *bus; | 48 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 8, .opc2 = 2, |
52 | DeviceState *carddev; | 49 | .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, |
53 | 50 | + .fgt = FGT_ATS1E0R, | |
54 | - if (machine->ram_size > 1 * GiB) { | 51 | .writefn = ats_write64 }, |
55 | - error_report("Requested ram size is too large for this machine: " | 52 | { .name = "AT_S1E0W", .state = ARM_CP_STATE_AA64, |
56 | - "maximum is 1GB"); | 53 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 8, .opc2 = 3, |
57 | + if (machine->ram_size != ram_size) { | 54 | .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, |
58 | + char *size_str = size_to_str(ram_size); | 55 | + .fgt = FGT_ATS1E0W, |
59 | + error_report("Invalid RAM size, should be %s", size_str); | 56 | .writefn = ats_write64 }, |
60 | + g_free(size_str); | 57 | { .name = "AT_S12E1R", .state = ARM_CP_STATE_AA64, |
61 | exit(1); | 58 | .opc0 = 1, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 4, |
62 | } | 59 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo ats1e1_reginfo[] = { |
60 | { .name = "AT_S1E1RP", .state = ARM_CP_STATE_AA64, | ||
61 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 9, .opc2 = 0, | ||
62 | .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, | ||
63 | + .fgt = FGT_ATS1E1RP, | ||
64 | .writefn = ats_write64 }, | ||
65 | { .name = "AT_S1E1WP", .state = ARM_CP_STATE_AA64, | ||
66 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 9, .opc2 = 1, | ||
67 | .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, | ||
68 | + .fgt = FGT_ATS1E1WP, | ||
69 | .writefn = ats_write64 }, | ||
70 | }; | ||
63 | 71 | ||
64 | -- | 72 | -- |
65 | 2.20.1 | 73 | 2.34.1 |
66 | |||
67 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | Mark up the sysreg definitions for the system instructions |
---|---|---|---|
2 | trapped by HFGITR bits 18..47. These bits cover TLBI | ||
3 | TLB maintenance instructions. | ||
2 | 4 | ||
3 | Use a common predicate for querying stage1-ness. | 5 | (If we implemented FEAT_XS we would need to trap some of the |
6 | instructions added by that feature using these bits; but we don't | ||
7 | yet, so will need to add the .fgt markup when we do.) | ||
4 | 8 | ||
5 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
6 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20200208125816.14954-2-richard.henderson@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | Tested-by: Fuad Tabba <tabba@google.com> | ||
12 | Message-id: 20230130182459.3309057-19-peter.maydell@linaro.org | ||
13 | Message-id: 20230127175507.2895013-19-peter.maydell@linaro.org | ||
10 | --- | 14 | --- |
11 | target/arm/internals.h | 18 ++++++++++++++++++ | 15 | target/arm/cpregs.h | 30 ++++++++++++++++++++++++++++++ |
12 | target/arm/helper.c | 8 +++----- | 16 | target/arm/helper.c | 30 ++++++++++++++++++++++++++++++ |
13 | 2 files changed, 21 insertions(+), 5 deletions(-) | 17 | 2 files changed, 60 insertions(+) |
14 | 18 | ||
15 | diff --git a/target/arm/internals.h b/target/arm/internals.h | 19 | diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h |
16 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/internals.h | 21 | --- a/target/arm/cpregs.h |
18 | +++ b/target/arm/internals.h | 22 | +++ b/target/arm/cpregs.h |
19 | @@ -XXX,XX +XXX,XX @@ static inline ARMMMUIdx arm_stage1_mmu_idx(CPUARMState *env) | 23 | @@ -XXX,XX +XXX,XX @@ typedef enum FGTBit { |
20 | ARMMMUIdx arm_stage1_mmu_idx(CPUARMState *env); | 24 | DO_BIT(HFGITR, ATS1E0W), |
21 | #endif | 25 | DO_BIT(HFGITR, ATS1E1RP), |
22 | 26 | DO_BIT(HFGITR, ATS1E1WP), | |
23 | +/** | 27 | + DO_BIT(HFGITR, TLBIVMALLE1OS), |
24 | + * arm_mmu_idx_is_stage1_of_2: | 28 | + DO_BIT(HFGITR, TLBIVAE1OS), |
25 | + * @mmu_idx: The ARMMMUIdx to test | 29 | + DO_BIT(HFGITR, TLBIASIDE1OS), |
26 | + * | 30 | + DO_BIT(HFGITR, TLBIVAAE1OS), |
27 | + * Return true if @mmu_idx is a NOTLB mmu_idx that is the | 31 | + DO_BIT(HFGITR, TLBIVALE1OS), |
28 | + * first stage of a two stage regime. | 32 | + DO_BIT(HFGITR, TLBIVAALE1OS), |
29 | + */ | 33 | + DO_BIT(HFGITR, TLBIRVAE1OS), |
30 | +static inline bool arm_mmu_idx_is_stage1_of_2(ARMMMUIdx mmu_idx) | 34 | + DO_BIT(HFGITR, TLBIRVAAE1OS), |
31 | +{ | 35 | + DO_BIT(HFGITR, TLBIRVALE1OS), |
32 | + switch (mmu_idx) { | 36 | + DO_BIT(HFGITR, TLBIRVAALE1OS), |
33 | + case ARMMMUIdx_Stage1_E0: | 37 | + DO_BIT(HFGITR, TLBIVMALLE1IS), |
34 | + case ARMMMUIdx_Stage1_E1: | 38 | + DO_BIT(HFGITR, TLBIVAE1IS), |
35 | + return true; | 39 | + DO_BIT(HFGITR, TLBIASIDE1IS), |
36 | + default: | 40 | + DO_BIT(HFGITR, TLBIVAAE1IS), |
37 | + return false; | 41 | + DO_BIT(HFGITR, TLBIVALE1IS), |
38 | + } | 42 | + DO_BIT(HFGITR, TLBIVAALE1IS), |
39 | +} | 43 | + DO_BIT(HFGITR, TLBIRVAE1IS), |
40 | + | 44 | + DO_BIT(HFGITR, TLBIRVAAE1IS), |
41 | /* | 45 | + DO_BIT(HFGITR, TLBIRVALE1IS), |
42 | * Parameters of a given virtual address, as extracted from the | 46 | + DO_BIT(HFGITR, TLBIRVAALE1IS), |
43 | * translation control register (TCR) for a given regime. | 47 | + DO_BIT(HFGITR, TLBIRVAE1), |
48 | + DO_BIT(HFGITR, TLBIRVAAE1), | ||
49 | + DO_BIT(HFGITR, TLBIRVALE1), | ||
50 | + DO_BIT(HFGITR, TLBIRVAALE1), | ||
51 | + DO_BIT(HFGITR, TLBIVMALLE1), | ||
52 | + DO_BIT(HFGITR, TLBIVAE1), | ||
53 | + DO_BIT(HFGITR, TLBIASIDE1), | ||
54 | + DO_BIT(HFGITR, TLBIVAAE1), | ||
55 | + DO_BIT(HFGITR, TLBIVALE1), | ||
56 | + DO_BIT(HFGITR, TLBIVAALE1), | ||
57 | } FGTBit; | ||
58 | |||
59 | #undef DO_BIT | ||
44 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 60 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
45 | index XXXXXXX..XXXXXXX 100644 | 61 | index XXXXXXX..XXXXXXX 100644 |
46 | --- a/target/arm/helper.c | 62 | --- a/target/arm/helper.c |
47 | +++ b/target/arm/helper.c | 63 | +++ b/target/arm/helper.c |
48 | @@ -XXX,XX +XXX,XX @@ static uint64_t do_ats_write(CPUARMState *env, uint64_t value, | 64 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { |
49 | bool take_exc = false; | 65 | { .name = "TLBI_VMALLE1IS", .state = ARM_CP_STATE_AA64, |
50 | 66 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 0, | |
51 | if (fi.s1ptw && current_el == 1 && !arm_is_secure(env) | 67 | .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW, |
52 | - && (mmu_idx == ARMMMUIdx_Stage1_E1 || | 68 | + .fgt = FGT_TLBIVMALLE1IS, |
53 | - mmu_idx == ARMMMUIdx_Stage1_E0)) { | 69 | .writefn = tlbi_aa64_vmalle1is_write }, |
54 | + && arm_mmu_idx_is_stage1_of_2(mmu_idx)) { | 70 | { .name = "TLBI_VAE1IS", .state = ARM_CP_STATE_AA64, |
55 | /* | 71 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 1, |
56 | * Synchronous stage 2 fault on an access made as part of the | 72 | .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW, |
57 | * translation table walk for AT S1E0* or AT S1E1* insn | 73 | + .fgt = FGT_TLBIVAE1IS, |
58 | @@ -XXX,XX +XXX,XX @@ static inline bool regime_translation_disabled(CPUARMState *env, | 74 | .writefn = tlbi_aa64_vae1is_write }, |
59 | } | 75 | { .name = "TLBI_ASIDE1IS", .state = ARM_CP_STATE_AA64, |
60 | } | 76 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 2, |
61 | 77 | .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW, | |
62 | - if ((env->cp15.hcr_el2 & HCR_DC) && | 78 | + .fgt = FGT_TLBIASIDE1IS, |
63 | - (mmu_idx == ARMMMUIdx_Stage1_E0 || mmu_idx == ARMMMUIdx_Stage1_E1)) { | 79 | .writefn = tlbi_aa64_vmalle1is_write }, |
64 | + if ((env->cp15.hcr_el2 & HCR_DC) && arm_mmu_idx_is_stage1_of_2(mmu_idx)) { | 80 | { .name = "TLBI_VAAE1IS", .state = ARM_CP_STATE_AA64, |
65 | /* HCR.DC means SCTLR_EL1.M behaves as 0 */ | 81 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 3, |
66 | return true; | 82 | .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW, |
67 | } | 83 | + .fgt = FGT_TLBIVAAE1IS, |
68 | @@ -XXX,XX +XXX,XX @@ static hwaddr S1_ptw_translate(CPUARMState *env, ARMMMUIdx mmu_idx, | 84 | .writefn = tlbi_aa64_vae1is_write }, |
69 | hwaddr addr, MemTxAttrs txattrs, | 85 | { .name = "TLBI_VALE1IS", .state = ARM_CP_STATE_AA64, |
70 | ARMMMUFaultInfo *fi) | 86 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 5, |
71 | { | 87 | .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW, |
72 | - if ((mmu_idx == ARMMMUIdx_Stage1_E0 || mmu_idx == ARMMMUIdx_Stage1_E1) && | 88 | + .fgt = FGT_TLBIVALE1IS, |
73 | + if (arm_mmu_idx_is_stage1_of_2(mmu_idx) && | 89 | .writefn = tlbi_aa64_vae1is_write }, |
74 | !regime_translation_disabled(env, ARMMMUIdx_Stage2)) { | 90 | { .name = "TLBI_VAALE1IS", .state = ARM_CP_STATE_AA64, |
75 | target_ulong s2size; | 91 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 7, |
76 | hwaddr s2pa; | 92 | .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW, |
93 | + .fgt = FGT_TLBIVAALE1IS, | ||
94 | .writefn = tlbi_aa64_vae1is_write }, | ||
95 | { .name = "TLBI_VMALLE1", .state = ARM_CP_STATE_AA64, | ||
96 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 7, .opc2 = 0, | ||
97 | .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, | ||
98 | + .fgt = FGT_TLBIVMALLE1, | ||
99 | .writefn = tlbi_aa64_vmalle1_write }, | ||
100 | { .name = "TLBI_VAE1", .state = ARM_CP_STATE_AA64, | ||
101 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 7, .opc2 = 1, | ||
102 | .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, | ||
103 | + .fgt = FGT_TLBIVAE1, | ||
104 | .writefn = tlbi_aa64_vae1_write }, | ||
105 | { .name = "TLBI_ASIDE1", .state = ARM_CP_STATE_AA64, | ||
106 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 7, .opc2 = 2, | ||
107 | .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, | ||
108 | + .fgt = FGT_TLBIASIDE1, | ||
109 | .writefn = tlbi_aa64_vmalle1_write }, | ||
110 | { .name = "TLBI_VAAE1", .state = ARM_CP_STATE_AA64, | ||
111 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 7, .opc2 = 3, | ||
112 | .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, | ||
113 | + .fgt = FGT_TLBIVAAE1, | ||
114 | .writefn = tlbi_aa64_vae1_write }, | ||
115 | { .name = "TLBI_VALE1", .state = ARM_CP_STATE_AA64, | ||
116 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 7, .opc2 = 5, | ||
117 | .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, | ||
118 | + .fgt = FGT_TLBIVALE1, | ||
119 | .writefn = tlbi_aa64_vae1_write }, | ||
120 | { .name = "TLBI_VAALE1", .state = ARM_CP_STATE_AA64, | ||
121 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 7, .opc2 = 7, | ||
122 | .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, | ||
123 | + .fgt = FGT_TLBIVAALE1, | ||
124 | .writefn = tlbi_aa64_vae1_write }, | ||
125 | { .name = "TLBI_IPAS2E1IS", .state = ARM_CP_STATE_AA64, | ||
126 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 0, .opc2 = 1, | ||
127 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo tlbirange_reginfo[] = { | ||
128 | { .name = "TLBI_RVAE1IS", .state = ARM_CP_STATE_AA64, | ||
129 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 2, .opc2 = 1, | ||
130 | .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW, | ||
131 | + .fgt = FGT_TLBIRVAE1IS, | ||
132 | .writefn = tlbi_aa64_rvae1is_write }, | ||
133 | { .name = "TLBI_RVAAE1IS", .state = ARM_CP_STATE_AA64, | ||
134 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 2, .opc2 = 3, | ||
135 | .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW, | ||
136 | + .fgt = FGT_TLBIRVAAE1IS, | ||
137 | .writefn = tlbi_aa64_rvae1is_write }, | ||
138 | { .name = "TLBI_RVALE1IS", .state = ARM_CP_STATE_AA64, | ||
139 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 2, .opc2 = 5, | ||
140 | .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW, | ||
141 | + .fgt = FGT_TLBIRVALE1IS, | ||
142 | .writefn = tlbi_aa64_rvae1is_write }, | ||
143 | { .name = "TLBI_RVAALE1IS", .state = ARM_CP_STATE_AA64, | ||
144 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 2, .opc2 = 7, | ||
145 | .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW, | ||
146 | + .fgt = FGT_TLBIRVAALE1IS, | ||
147 | .writefn = tlbi_aa64_rvae1is_write }, | ||
148 | { .name = "TLBI_RVAE1OS", .state = ARM_CP_STATE_AA64, | ||
149 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 5, .opc2 = 1, | ||
150 | .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW, | ||
151 | + .fgt = FGT_TLBIRVAE1OS, | ||
152 | .writefn = tlbi_aa64_rvae1is_write }, | ||
153 | { .name = "TLBI_RVAAE1OS", .state = ARM_CP_STATE_AA64, | ||
154 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 5, .opc2 = 3, | ||
155 | .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW, | ||
156 | + .fgt = FGT_TLBIRVAAE1OS, | ||
157 | .writefn = tlbi_aa64_rvae1is_write }, | ||
158 | { .name = "TLBI_RVALE1OS", .state = ARM_CP_STATE_AA64, | ||
159 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 5, .opc2 = 5, | ||
160 | .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW, | ||
161 | + .fgt = FGT_TLBIRVALE1OS, | ||
162 | .writefn = tlbi_aa64_rvae1is_write }, | ||
163 | { .name = "TLBI_RVAALE1OS", .state = ARM_CP_STATE_AA64, | ||
164 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 5, .opc2 = 7, | ||
165 | .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW, | ||
166 | + .fgt = FGT_TLBIRVAALE1OS, | ||
167 | .writefn = tlbi_aa64_rvae1is_write }, | ||
168 | { .name = "TLBI_RVAE1", .state = ARM_CP_STATE_AA64, | ||
169 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 6, .opc2 = 1, | ||
170 | .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, | ||
171 | + .fgt = FGT_TLBIRVAE1, | ||
172 | .writefn = tlbi_aa64_rvae1_write }, | ||
173 | { .name = "TLBI_RVAAE1", .state = ARM_CP_STATE_AA64, | ||
174 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 6, .opc2 = 3, | ||
175 | .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, | ||
176 | + .fgt = FGT_TLBIRVAAE1, | ||
177 | .writefn = tlbi_aa64_rvae1_write }, | ||
178 | { .name = "TLBI_RVALE1", .state = ARM_CP_STATE_AA64, | ||
179 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 6, .opc2 = 5, | ||
180 | .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, | ||
181 | + .fgt = FGT_TLBIRVALE1, | ||
182 | .writefn = tlbi_aa64_rvae1_write }, | ||
183 | { .name = "TLBI_RVAALE1", .state = ARM_CP_STATE_AA64, | ||
184 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 6, .opc2 = 7, | ||
185 | .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, | ||
186 | + .fgt = FGT_TLBIRVAALE1, | ||
187 | .writefn = tlbi_aa64_rvae1_write }, | ||
188 | { .name = "TLBI_RIPAS2E1IS", .state = ARM_CP_STATE_AA64, | ||
189 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 0, .opc2 = 2, | ||
190 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo tlbios_reginfo[] = { | ||
191 | { .name = "TLBI_VMALLE1OS", .state = ARM_CP_STATE_AA64, | ||
192 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 1, .opc2 = 0, | ||
193 | .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW, | ||
194 | + .fgt = FGT_TLBIVMALLE1OS, | ||
195 | .writefn = tlbi_aa64_vmalle1is_write }, | ||
196 | { .name = "TLBI_VAE1OS", .state = ARM_CP_STATE_AA64, | ||
197 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 1, .opc2 = 1, | ||
198 | + .fgt = FGT_TLBIVAE1OS, | ||
199 | .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW, | ||
200 | .writefn = tlbi_aa64_vae1is_write }, | ||
201 | { .name = "TLBI_ASIDE1OS", .state = ARM_CP_STATE_AA64, | ||
202 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 1, .opc2 = 2, | ||
203 | .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW, | ||
204 | + .fgt = FGT_TLBIASIDE1OS, | ||
205 | .writefn = tlbi_aa64_vmalle1is_write }, | ||
206 | { .name = "TLBI_VAAE1OS", .state = ARM_CP_STATE_AA64, | ||
207 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 1, .opc2 = 3, | ||
208 | .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW, | ||
209 | + .fgt = FGT_TLBIVAAE1OS, | ||
210 | .writefn = tlbi_aa64_vae1is_write }, | ||
211 | { .name = "TLBI_VALE1OS", .state = ARM_CP_STATE_AA64, | ||
212 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 1, .opc2 = 5, | ||
213 | .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW, | ||
214 | + .fgt = FGT_TLBIVALE1OS, | ||
215 | .writefn = tlbi_aa64_vae1is_write }, | ||
216 | { .name = "TLBI_VAALE1OS", .state = ARM_CP_STATE_AA64, | ||
217 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 1, .opc2 = 7, | ||
218 | .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW, | ||
219 | + .fgt = FGT_TLBIVAALE1OS, | ||
220 | .writefn = tlbi_aa64_vae1is_write }, | ||
221 | { .name = "TLBI_ALLE2OS", .state = ARM_CP_STATE_AA64, | ||
222 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 1, .opc2 = 0, | ||
77 | -- | 223 | -- |
78 | 2.20.1 | 224 | 2.34.1 |
79 | |||
80 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
2 | 1 | ||
3 | Using ~0 as the mask on the aarch64->aarch32 exception return | ||
4 | was not even as correct as the CPSR_ERET_MASK that we had used | ||
5 | on the aarch32->aarch32 exception return. | ||
6 | |||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20200208125816.14954-9-richard.henderson@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | target/arm/helper-a64.c | 5 +++-- | ||
13 | 1 file changed, 3 insertions(+), 2 deletions(-) | ||
14 | |||
15 | diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/target/arm/helper-a64.c | ||
18 | +++ b/target/arm/helper-a64.c | ||
19 | @@ -XXX,XX +XXX,XX @@ void HELPER(exception_return)(CPUARMState *env, uint64_t new_pc) | ||
20 | { | ||
21 | int cur_el = arm_current_el(env); | ||
22 | unsigned int spsr_idx = aarch64_banked_spsr_index(cur_el); | ||
23 | - uint32_t spsr = env->banked_spsr[spsr_idx]; | ||
24 | + uint32_t mask, spsr = env->banked_spsr[spsr_idx]; | ||
25 | int new_el; | ||
26 | bool return_to_aa64 = (spsr & PSTATE_nRW) == 0; | ||
27 | |||
28 | @@ -XXX,XX +XXX,XX @@ void HELPER(exception_return)(CPUARMState *env, uint64_t new_pc) | ||
29 | * will sort the register banks out for us, and we've already | ||
30 | * caught all the bad-mode cases in el_from_spsr(). | ||
31 | */ | ||
32 | - cpsr_write(env, spsr, ~0, CPSRWriteRaw); | ||
33 | + mask = aarch32_cpsr_valid_mask(env->features, &env_archcpu(env)->isar); | ||
34 | + cpsr_write(env, spsr, mask, CPSRWriteRaw); | ||
35 | if (!arm_singlestep_active(env)) { | ||
36 | env->uncached_cpsr &= ~PSTATE_SS; | ||
37 | } | ||
38 | -- | ||
39 | 2.20.1 | ||
40 | |||
41 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | Mark up the sysreg definitions for the system instructions |
---|---|---|---|
2 | trapped by HFGITR bits 48..63. | ||
2 | 3 | ||
3 | If we have a PAN-enforcing mmu_idx, set prot == 0 if user_rw != 0. | 4 | Some of these bits are for trapping instructions which are |
5 | not in the system instruction encoding (i.e. which are | ||
6 | not handled by the ARMCPRegInfo mechanism): | ||
7 | * ERET, ERETAA, ERETAB | ||
8 | * SVC | ||
4 | 9 | ||
5 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 10 | We will have to handle those separately and manually. |
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 11 | |
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20200208125816.14954-14-richard.henderson@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
14 | Tested-by: Fuad Tabba <tabba@google.com> | ||
15 | Message-id: 20230130182459.3309057-20-peter.maydell@linaro.org | ||
16 | Message-id: 20230127175507.2895013-20-peter.maydell@linaro.org | ||
10 | --- | 17 | --- |
11 | target/arm/internals.h | 13 +++++++++++++ | 18 | target/arm/cpregs.h | 4 ++++ |
12 | target/arm/helper.c | 3 +++ | 19 | target/arm/helper.c | 9 +++++++++ |
13 | 2 files changed, 16 insertions(+) | 20 | 2 files changed, 13 insertions(+) |
14 | 21 | ||
15 | diff --git a/target/arm/internals.h b/target/arm/internals.h | 22 | diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h |
16 | index XXXXXXX..XXXXXXX 100644 | 23 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/internals.h | 24 | --- a/target/arm/cpregs.h |
18 | +++ b/target/arm/internals.h | 25 | +++ b/target/arm/cpregs.h |
19 | @@ -XXX,XX +XXX,XX @@ static inline bool regime_is_secure(CPUARMState *env, ARMMMUIdx mmu_idx) | 26 | @@ -XXX,XX +XXX,XX @@ typedef enum FGTBit { |
20 | } | 27 | DO_BIT(HFGITR, TLBIVAAE1), |
21 | } | 28 | DO_BIT(HFGITR, TLBIVALE1), |
22 | 29 | DO_BIT(HFGITR, TLBIVAALE1), | |
23 | +static inline bool regime_is_pan(CPUARMState *env, ARMMMUIdx mmu_idx) | 30 | + DO_BIT(HFGITR, CFPRCTX), |
24 | +{ | 31 | + DO_BIT(HFGITR, DVPRCTX), |
25 | + switch (mmu_idx) { | 32 | + DO_BIT(HFGITR, CPPRCTX), |
26 | + case ARMMMUIdx_Stage1_E1_PAN: | 33 | + DO_BIT(HFGITR, DCCVAC), |
27 | + case ARMMMUIdx_E10_1_PAN: | 34 | } FGTBit; |
28 | + case ARMMMUIdx_E20_2_PAN: | 35 | |
29 | + case ARMMMUIdx_SE10_1_PAN: | 36 | #undef DO_BIT |
30 | + return true; | ||
31 | + default: | ||
32 | + return false; | ||
33 | + } | ||
34 | +} | ||
35 | + | ||
36 | /* Return the FSR value for a debug exception (watchpoint, hardware | ||
37 | * breakpoint or BKPT insn) targeting the specified exception level. | ||
38 | */ | ||
39 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 37 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
40 | index XXXXXXX..XXXXXXX 100644 | 38 | index XXXXXXX..XXXXXXX 100644 |
41 | --- a/target/arm/helper.c | 39 | --- a/target/arm/helper.c |
42 | +++ b/target/arm/helper.c | 40 | +++ b/target/arm/helper.c |
43 | @@ -XXX,XX +XXX,XX @@ static int get_S1prot(CPUARMState *env, ARMMMUIdx mmu_idx, bool is_aa64, | 41 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { |
44 | if (is_user) { | 42 | { .name = "DC_CVAC", .state = ARM_CP_STATE_AA64, |
45 | prot_rw = user_rw; | 43 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 10, .opc2 = 1, |
46 | } else { | 44 | .access = PL0_W, .type = ARM_CP_NOP, |
47 | + if (user_rw && regime_is_pan(env, mmu_idx)) { | 45 | + .fgt = FGT_DCCVAC, |
48 | + return 0; | 46 | .accessfn = aa64_cacheop_poc_access }, |
49 | + } | 47 | { .name = "DC_CSW", .state = ARM_CP_STATE_AA64, |
50 | prot_rw = simple_ap_to_rw_prot_is_user(ap, false); | 48 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 10, .opc2 = 2, |
51 | } | 49 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo mte_el0_cacheop_reginfo[] = { |
50 | { .name = "DC_CGVAC", .state = ARM_CP_STATE_AA64, | ||
51 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 10, .opc2 = 3, | ||
52 | .type = ARM_CP_NOP, .access = PL0_W, | ||
53 | + .fgt = FGT_DCCVAC, | ||
54 | .accessfn = aa64_cacheop_poc_access }, | ||
55 | { .name = "DC_CGDVAC", .state = ARM_CP_STATE_AA64, | ||
56 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 10, .opc2 = 5, | ||
57 | .type = ARM_CP_NOP, .access = PL0_W, | ||
58 | + .fgt = FGT_DCCVAC, | ||
59 | .accessfn = aa64_cacheop_poc_access }, | ||
60 | { .name = "DC_CGVAP", .state = ARM_CP_STATE_AA64, | ||
61 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 12, .opc2 = 3, | ||
62 | @@ -XXX,XX +XXX,XX @@ static CPAccessResult access_predinv(CPUARMState *env, const ARMCPRegInfo *ri, | ||
63 | static const ARMCPRegInfo predinv_reginfo[] = { | ||
64 | { .name = "CFP_RCTX", .state = ARM_CP_STATE_AA64, | ||
65 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 3, .opc2 = 4, | ||
66 | + .fgt = FGT_CFPRCTX, | ||
67 | .type = ARM_CP_NOP, .access = PL0_W, .accessfn = access_predinv }, | ||
68 | { .name = "DVP_RCTX", .state = ARM_CP_STATE_AA64, | ||
69 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 3, .opc2 = 5, | ||
70 | + .fgt = FGT_DVPRCTX, | ||
71 | .type = ARM_CP_NOP, .access = PL0_W, .accessfn = access_predinv }, | ||
72 | { .name = "CPP_RCTX", .state = ARM_CP_STATE_AA64, | ||
73 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 3, .opc2 = 7, | ||
74 | + .fgt = FGT_CPPRCTX, | ||
75 | .type = ARM_CP_NOP, .access = PL0_W, .accessfn = access_predinv }, | ||
76 | /* | ||
77 | * Note the AArch32 opcodes have a different OPC1. | ||
78 | */ | ||
79 | { .name = "CFPRCTX", .state = ARM_CP_STATE_AA32, | ||
80 | .cp = 15, .opc1 = 0, .crn = 7, .crm = 3, .opc2 = 4, | ||
81 | + .fgt = FGT_CFPRCTX, | ||
82 | .type = ARM_CP_NOP, .access = PL0_W, .accessfn = access_predinv }, | ||
83 | { .name = "DVPRCTX", .state = ARM_CP_STATE_AA32, | ||
84 | .cp = 15, .opc1 = 0, .crn = 7, .crm = 3, .opc2 = 5, | ||
85 | + .fgt = FGT_DVPRCTX, | ||
86 | .type = ARM_CP_NOP, .access = PL0_W, .accessfn = access_predinv }, | ||
87 | { .name = "CPPRCTX", .state = ARM_CP_STATE_AA32, | ||
88 | .cp = 15, .opc1 = 0, .crn = 7, .crm = 3, .opc2 = 7, | ||
89 | + .fgt = FGT_CPPRCTX, | ||
90 | .type = ARM_CP_NOP, .access = PL0_W, .accessfn = access_predinv }, | ||
91 | }; | ||
52 | 92 | ||
53 | -- | 93 | -- |
54 | 2.20.1 | 94 | 2.34.1 |
55 | |||
56 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | Implement the HFGITR_EL2.ERET fine-grained trap. This traps |
---|---|---|---|
2 | execution from AArch64 EL1 of ERET, ERETAA and ERETAB. The trap is | ||
3 | reported with a syndrome value of 0x1a. | ||
2 | 4 | ||
3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 5 | The trap must take precedence over a possible pointer-authentication |
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | trap for ERETAA and ERETAB. |
5 | Message-id: 20200208125816.14954-19-richard.henderson@linaro.org | 7 | |
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Tested-by: Fuad Tabba <tabba@google.com> | ||
11 | Message-id: 20230130182459.3309057-21-peter.maydell@linaro.org | ||
12 | Message-id: 20230127175507.2895013-21-peter.maydell@linaro.org | ||
7 | --- | 13 | --- |
8 | target/arm/cpu.h | 6 ++++++ | 14 | target/arm/cpu.h | 1 + |
9 | target/arm/internals.h | 3 +++ | 15 | target/arm/syndrome.h | 10 ++++++++++ |
10 | target/arm/helper.c | 21 +++++++++++++++++++++ | 16 | target/arm/translate.h | 2 ++ |
11 | target/arm/translate-a64.c | 14 ++++++++++++++ | 17 | target/arm/helper.c | 3 +++ |
12 | 4 files changed, 44 insertions(+) | 18 | target/arm/translate-a64.c | 10 ++++++++++ |
19 | 5 files changed, 26 insertions(+) | ||
13 | 20 | ||
14 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 21 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h |
15 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/cpu.h | 23 | --- a/target/arm/cpu.h |
17 | +++ b/target/arm/cpu.h | 24 | +++ b/target/arm/cpu.h |
18 | @@ -XXX,XX +XXX,XX @@ void pmu_init(ARMCPU *cpu); | 25 | @@ -XXX,XX +XXX,XX @@ FIELD(TBFLAG_A64, PSTATE_ZA, 23, 1) |
19 | #define PSTATE_IL (1U << 20) | 26 | FIELD(TBFLAG_A64, SVL, 24, 4) |
20 | #define PSTATE_SS (1U << 21) | 27 | /* Indicates that SME Streaming mode is active, and SMCR_ELx.FA64 is not. */ |
21 | #define PSTATE_PAN (1U << 22) | 28 | FIELD(TBFLAG_A64, SME_TRAP_NONSTREAMING, 28, 1) |
22 | +#define PSTATE_UAO (1U << 23) | 29 | +FIELD(TBFLAG_A64, FGT_ERET, 29, 1) |
23 | #define PSTATE_V (1U << 28) | 30 | |
24 | #define PSTATE_C (1U << 29) | 31 | /* |
25 | #define PSTATE_Z (1U << 30) | 32 | * Helpers for using the above. |
26 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_ats1e1(const ARMISARegisters *id) | 33 | diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h |
27 | return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, PAN) >= 2; | 34 | index XXXXXXX..XXXXXXX 100644 |
35 | --- a/target/arm/syndrome.h | ||
36 | +++ b/target/arm/syndrome.h | ||
37 | @@ -XXX,XX +XXX,XX @@ enum arm_exception_class { | ||
38 | EC_AA64_SMC = 0x17, | ||
39 | EC_SYSTEMREGISTERTRAP = 0x18, | ||
40 | EC_SVEACCESSTRAP = 0x19, | ||
41 | + EC_ERETTRAP = 0x1a, | ||
42 | EC_SMETRAP = 0x1d, | ||
43 | EC_INSNABORT = 0x20, | ||
44 | EC_INSNABORT_SAME_EL = 0x21, | ||
45 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t syn_sve_access_trap(void) | ||
46 | return EC_SVEACCESSTRAP << ARM_EL_EC_SHIFT; | ||
28 | } | 47 | } |
29 | 48 | ||
30 | +static inline bool isar_feature_aa64_uao(const ARMISARegisters *id) | 49 | +/* |
50 | + * eret_op is bits [1:0] of the ERET instruction, so: | ||
51 | + * 0 for ERET, 2 for ERETAA, 3 for ERETAB. | ||
52 | + */ | ||
53 | +static inline uint32_t syn_erettrap(int eret_op) | ||
31 | +{ | 54 | +{ |
32 | + return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, UAO) != 0; | 55 | + return (EC_ERETTRAP << ARM_EL_EC_SHIFT) | ARM_EL_IL | eret_op; |
33 | +} | 56 | +} |
34 | + | 57 | + |
35 | static inline bool isar_feature_aa64_bti(const ARMISARegisters *id) | 58 | static inline uint32_t syn_smetrap(SMEExceptionType etype, bool is_16bit) |
36 | { | 59 | { |
37 | return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, BT) != 0; | 60 | return (EC_SMETRAP << ARM_EL_EC_SHIFT) |
38 | diff --git a/target/arm/internals.h b/target/arm/internals.h | 61 | diff --git a/target/arm/translate.h b/target/arm/translate.h |
39 | index XXXXXXX..XXXXXXX 100644 | 62 | index XXXXXXX..XXXXXXX 100644 |
40 | --- a/target/arm/internals.h | 63 | --- a/target/arm/translate.h |
41 | +++ b/target/arm/internals.h | 64 | +++ b/target/arm/translate.h |
42 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t aarch64_pstate_valid_mask(const ARMISARegisters *id) | 65 | @@ -XXX,XX +XXX,XX @@ typedef struct DisasContext { |
43 | if (isar_feature_aa64_pan(id)) { | 66 | bool mve_no_pred; |
44 | valid |= PSTATE_PAN; | 67 | /* True if fine-grained traps are active */ |
45 | } | 68 | bool fgt_active; |
46 | + if (isar_feature_aa64_uao(id)) { | 69 | + /* True if fine-grained trap on ERET is enabled */ |
47 | + valid |= PSTATE_UAO; | 70 | + bool fgt_eret; |
48 | + } | 71 | /* |
49 | 72 | * >= 0, a copy of PSTATE.BTYPE, which will be 0 without v8.5-BTI. | |
50 | return valid; | 73 | * < 0, set by the current instruction. |
51 | } | ||
52 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 74 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
53 | index XXXXXXX..XXXXXXX 100644 | 75 | index XXXXXXX..XXXXXXX 100644 |
54 | --- a/target/arm/helper.c | 76 | --- a/target/arm/helper.c |
55 | +++ b/target/arm/helper.c | 77 | +++ b/target/arm/helper.c |
56 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo pan_reginfo = { | 78 | @@ -XXX,XX +XXX,XX @@ static CPUARMTBFlags rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, |
57 | .readfn = aa64_pan_read, .writefn = aa64_pan_write | 79 | |
58 | }; | 80 | if (arm_fgt_active(env, el)) { |
59 | 81 | DP_TBFLAG_ANY(flags, FGT_ACTIVE, 1); | |
60 | +static uint64_t aa64_uao_read(CPUARMState *env, const ARMCPRegInfo *ri) | 82 | + if (FIELD_EX64(env->cp15.fgt_exec[FGTREG_HFGITR], HFGITR_EL2, ERET)) { |
61 | +{ | 83 | + DP_TBFLAG_A64(flags, FGT_ERET, 1); |
62 | + return env->pstate & PSTATE_UAO; | 84 | + } |
63 | +} | ||
64 | + | ||
65 | +static void aa64_uao_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
66 | + uint64_t value) | ||
67 | +{ | ||
68 | + env->pstate = (env->pstate & ~PSTATE_UAO) | (value & PSTATE_UAO); | ||
69 | +} | ||
70 | + | ||
71 | +static const ARMCPRegInfo uao_reginfo = { | ||
72 | + .name = "UAO", .state = ARM_CP_STATE_AA64, | ||
73 | + .opc0 = 3, .opc1 = 0, .crn = 4, .crm = 2, .opc2 = 4, | ||
74 | + .type = ARM_CP_NO_RAW, .access = PL1_RW, | ||
75 | + .readfn = aa64_uao_read, .writefn = aa64_uao_write | ||
76 | +}; | ||
77 | + | ||
78 | static CPAccessResult aa64_cacheop_access(CPUARMState *env, | ||
79 | const ARMCPRegInfo *ri, | ||
80 | bool isread) | ||
81 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
82 | define_arm_cp_regs(cpu, ats1cp_reginfo); | ||
83 | } | 85 | } |
84 | #endif | 86 | |
85 | + if (cpu_isar_feature(aa64_uao, cpu)) { | 87 | if (cpu_isar_feature(aa64_mte, env_archcpu(env))) { |
86 | + define_one_arm_cp_reg(cpu, &uao_reginfo); | ||
87 | + } | ||
88 | |||
89 | if (arm_feature(env, ARM_FEATURE_EL2) && cpu_isar_feature(aa64_vh, cpu)) { | ||
90 | define_arm_cp_regs(cpu, vhe_reginfo); | ||
91 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 88 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
92 | index XXXXXXX..XXXXXXX 100644 | 89 | index XXXXXXX..XXXXXXX 100644 |
93 | --- a/target/arm/translate-a64.c | 90 | --- a/target/arm/translate-a64.c |
94 | +++ b/target/arm/translate-a64.c | 91 | +++ b/target/arm/translate-a64.c |
95 | @@ -XXX,XX +XXX,XX @@ static void handle_msr_i(DisasContext *s, uint32_t insn, | 92 | @@ -XXX,XX +XXX,XX @@ static void disas_uncond_b_reg(DisasContext *s, uint32_t insn) |
96 | s->base.is_jmp = DISAS_NEXT; | 93 | if (op4 != 0) { |
97 | break; | 94 | goto do_unallocated; |
98 | 95 | } | |
99 | + case 0x03: /* UAO */ | 96 | + if (s->fgt_eret) { |
100 | + if (!dc_isar_feature(aa64_uao, s) || s->current_el == 0) { | 97 | + gen_exception_insn_el(s, 0, EXCP_UDEF, syn_erettrap(op3), 2); |
101 | + goto do_unallocated; | 98 | + return; |
102 | + } | 99 | + } |
103 | + if (crm & 1) { | 100 | dst = tcg_temp_new_i64(); |
104 | + set_pstate_bits(PSTATE_UAO); | 101 | tcg_gen_ld_i64(dst, cpu_env, |
105 | + } else { | 102 | offsetof(CPUARMState, elr_el[s->current_el])); |
106 | + clear_pstate_bits(PSTATE_UAO); | 103 | @@ -XXX,XX +XXX,XX @@ static void disas_uncond_b_reg(DisasContext *s, uint32_t insn) |
107 | + } | 104 | if (rn != 0x1f || op4 != 0x1f) { |
108 | + t1 = tcg_const_i32(s->current_el); | 105 | goto do_unallocated; |
109 | + gen_helper_rebuild_hflags_a64(cpu_env, t1); | 106 | } |
110 | + tcg_temp_free_i32(t1); | 107 | + /* The FGT trap takes precedence over an auth trap. */ |
111 | + break; | 108 | + if (s->fgt_eret) { |
112 | + | 109 | + gen_exception_insn_el(s, 0, EXCP_UDEF, syn_erettrap(op3), 2); |
113 | case 0x04: /* PAN */ | 110 | + return; |
114 | if (!dc_isar_feature(aa64_pan, s) || s->current_el == 0) { | 111 | + } |
115 | goto do_unallocated; | 112 | dst = tcg_temp_new_i64(); |
113 | tcg_gen_ld_i64(dst, cpu_env, | ||
114 | offsetof(CPUARMState, elr_el[s->current_el])); | ||
115 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, | ||
116 | dc->align_mem = EX_TBFLAG_ANY(tb_flags, ALIGN_MEM); | ||
117 | dc->pstate_il = EX_TBFLAG_ANY(tb_flags, PSTATE__IL); | ||
118 | dc->fgt_active = EX_TBFLAG_ANY(tb_flags, FGT_ACTIVE); | ||
119 | + dc->fgt_eret = EX_TBFLAG_A64(tb_flags, FGT_ERET); | ||
120 | dc->sve_excp_el = EX_TBFLAG_A64(tb_flags, SVEEXC_EL); | ||
121 | dc->sme_excp_el = EX_TBFLAG_A64(tb_flags, SMEEXC_EL); | ||
122 | dc->vl = (EX_TBFLAG_A64(tb_flags, VL) + 1) * 16; | ||
116 | -- | 123 | -- |
117 | 2.20.1 | 124 | 2.34.1 |
118 | |||
119 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | Implement the HFGITR_EL2.SVC_EL0 and SVC_EL1 fine-grained traps. |
---|---|---|---|
2 | These trap execution of the SVC instruction from AArch32 and AArch64. | ||
3 | (As usual, AArch32 can only trap from EL0, as fine grained traps are | ||
4 | disabled with an AArch32 EL1.) | ||
2 | 5 | ||
3 | For aarch64, there's a dedicated msr (imm, reg) insn. | ||
4 | For aarch32, this is done via msr to cpsr. Writes from el0 | ||
5 | are ignored, which is already handled by the CPSR_USER mask. | ||
6 | |||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20200208125816.14954-12-richard.henderson@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Tested-by: Fuad Tabba <tabba@google.com> | ||
9 | Message-id: 20230130182459.3309057-22-peter.maydell@linaro.org | ||
10 | Message-id: 20230127175507.2895013-22-peter.maydell@linaro.org | ||
11 | --- | 11 | --- |
12 | target/arm/cpu.h | 2 ++ | 12 | target/arm/cpu.h | 1 + |
13 | target/arm/internals.h | 6 ++++++ | 13 | target/arm/translate.h | 2 ++ |
14 | target/arm/helper.c | 21 +++++++++++++++++++++ | 14 | target/arm/helper.c | 20 ++++++++++++++++++++ |
15 | target/arm/translate-a64.c | 14 ++++++++++++++ | 15 | target/arm/translate-a64.c | 9 ++++++++- |
16 | 4 files changed, 43 insertions(+) | 16 | target/arm/translate.c | 12 +++++++++--- |
17 | 5 files changed, 40 insertions(+), 4 deletions(-) | ||
17 | 18 | ||
18 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 19 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h |
19 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/target/arm/cpu.h | 21 | --- a/target/arm/cpu.h |
21 | +++ b/target/arm/cpu.h | 22 | +++ b/target/arm/cpu.h |
22 | @@ -XXX,XX +XXX,XX @@ void pmu_init(ARMCPU *cpu); | 23 | @@ -XXX,XX +XXX,XX @@ FIELD(TBFLAG_ANY, FPEXC_EL, 8, 2) |
23 | #define CPSR_IT_2_7 (0xfc00U) | 24 | FIELD(TBFLAG_ANY, ALIGN_MEM, 10, 1) |
24 | #define CPSR_GE (0xfU << 16) | 25 | FIELD(TBFLAG_ANY, PSTATE__IL, 11, 1) |
25 | #define CPSR_IL (1U << 20) | 26 | FIELD(TBFLAG_ANY, FGT_ACTIVE, 12, 1) |
26 | +#define CPSR_PAN (1U << 22) | 27 | +FIELD(TBFLAG_ANY, FGT_SVC, 13, 1) |
27 | #define CPSR_J (1U << 24) | 28 | |
28 | #define CPSR_IT_0_1 (3U << 25) | 29 | /* |
29 | #define CPSR_Q (1U << 27) | 30 | * Bit usage when in AArch32 state, both A- and M-profile. |
30 | @@ -XXX,XX +XXX,XX @@ void pmu_init(ARMCPU *cpu); | 31 | diff --git a/target/arm/translate.h b/target/arm/translate.h |
31 | #define PSTATE_BTYPE (3U << 10) | ||
32 | #define PSTATE_IL (1U << 20) | ||
33 | #define PSTATE_SS (1U << 21) | ||
34 | +#define PSTATE_PAN (1U << 22) | ||
35 | #define PSTATE_V (1U << 28) | ||
36 | #define PSTATE_C (1U << 29) | ||
37 | #define PSTATE_Z (1U << 30) | ||
38 | diff --git a/target/arm/internals.h b/target/arm/internals.h | ||
39 | index XXXXXXX..XXXXXXX 100644 | 32 | index XXXXXXX..XXXXXXX 100644 |
40 | --- a/target/arm/internals.h | 33 | --- a/target/arm/translate.h |
41 | +++ b/target/arm/internals.h | 34 | +++ b/target/arm/translate.h |
42 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t aarch32_cpsr_valid_mask(uint64_t features, | 35 | @@ -XXX,XX +XXX,XX @@ typedef struct DisasContext { |
43 | if (isar_feature_jazelle(id)) { | 36 | bool fgt_active; |
44 | valid |= CPSR_J; | 37 | /* True if fine-grained trap on ERET is enabled */ |
45 | } | 38 | bool fgt_eret; |
46 | + if (isar_feature_aa32_pan(id)) { | 39 | + /* True if fine-grained trap on SVC is enabled */ |
47 | + valid |= CPSR_PAN; | 40 | + bool fgt_svc; |
48 | + } | 41 | /* |
49 | 42 | * >= 0, a copy of PSTATE.BTYPE, which will be 0 without v8.5-BTI. | |
50 | return valid; | 43 | * < 0, set by the current instruction. |
51 | } | ||
52 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t aarch64_pstate_valid_mask(const ARMISARegisters *id) | ||
53 | if (isar_feature_aa64_bti(id)) { | ||
54 | valid |= PSTATE_BTYPE; | ||
55 | } | ||
56 | + if (isar_feature_aa64_pan(id)) { | ||
57 | + valid |= PSTATE_PAN; | ||
58 | + } | ||
59 | |||
60 | return valid; | ||
61 | } | ||
62 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 44 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
63 | index XXXXXXX..XXXXXXX 100644 | 45 | index XXXXXXX..XXXXXXX 100644 |
64 | --- a/target/arm/helper.c | 46 | --- a/target/arm/helper.c |
65 | +++ b/target/arm/helper.c | 47 | +++ b/target/arm/helper.c |
66 | @@ -XXX,XX +XXX,XX @@ static void aa64_daif_write(CPUARMState *env, const ARMCPRegInfo *ri, | 48 | @@ -XXX,XX +XXX,XX @@ ARMMMUIdx arm_mmu_idx(CPUARMState *env) |
67 | env->daif = value & PSTATE_DAIF; | 49 | return arm_mmu_idx_el(env, arm_current_el(env)); |
68 | } | 50 | } |
69 | 51 | ||
70 | +static uint64_t aa64_pan_read(CPUARMState *env, const ARMCPRegInfo *ri) | 52 | +static inline bool fgt_svc(CPUARMState *env, int el) |
71 | +{ | 53 | +{ |
72 | + return env->pstate & PSTATE_PAN; | 54 | + /* |
55 | + * Assuming fine-grained-traps are active, return true if we | ||
56 | + * should be trapping on SVC instructions. Only AArch64 can | ||
57 | + * trap on an SVC at EL1, but we don't need to special-case this | ||
58 | + * because if this is AArch32 EL1 then arm_fgt_active() is false. | ||
59 | + * We also know el is 0 or 1. | ||
60 | + */ | ||
61 | + return el == 0 ? | ||
62 | + FIELD_EX64(env->cp15.fgt_exec[FGTREG_HFGITR], HFGITR_EL2, SVC_EL0) : | ||
63 | + FIELD_EX64(env->cp15.fgt_exec[FGTREG_HFGITR], HFGITR_EL2, SVC_EL1); | ||
73 | +} | 64 | +} |
74 | + | 65 | + |
75 | +static void aa64_pan_write(CPUARMState *env, const ARMCPRegInfo *ri, | 66 | static CPUARMTBFlags rebuild_hflags_common(CPUARMState *env, int fp_el, |
76 | + uint64_t value) | 67 | ARMMMUIdx mmu_idx, |
77 | +{ | 68 | CPUARMTBFlags flags) |
78 | + env->pstate = (env->pstate & ~PSTATE_PAN) | (value & PSTATE_PAN); | 69 | @@ -XXX,XX +XXX,XX @@ static CPUARMTBFlags rebuild_hflags_a32(CPUARMState *env, int fp_el, |
79 | +} | 70 | |
80 | + | 71 | if (arm_fgt_active(env, el)) { |
81 | +static const ARMCPRegInfo pan_reginfo = { | 72 | DP_TBFLAG_ANY(flags, FGT_ACTIVE, 1); |
82 | + .name = "PAN", .state = ARM_CP_STATE_AA64, | 73 | + if (fgt_svc(env, el)) { |
83 | + .opc0 = 3, .opc1 = 0, .crn = 4, .crm = 2, .opc2 = 3, | 74 | + DP_TBFLAG_ANY(flags, FGT_SVC, 1); |
84 | + .type = ARM_CP_NO_RAW, .access = PL1_RW, | 75 | + } |
85 | + .readfn = aa64_pan_read, .writefn = aa64_pan_write | ||
86 | +}; | ||
87 | + | ||
88 | static CPAccessResult aa64_cacheop_access(CPUARMState *env, | ||
89 | const ARMCPRegInfo *ri, | ||
90 | bool isread) | ||
91 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
92 | if (cpu_isar_feature(aa64_lor, cpu)) { | ||
93 | define_arm_cp_regs(cpu, lor_reginfo); | ||
94 | } | 76 | } |
95 | + if (cpu_isar_feature(aa64_pan, cpu)) { | 77 | |
96 | + define_one_arm_cp_reg(cpu, &pan_reginfo); | 78 | if (env->uncached_cpsr & CPSR_IL) { |
97 | + } | 79 | @@ -XXX,XX +XXX,XX @@ static CPUARMTBFlags rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, |
98 | 80 | if (FIELD_EX64(env->cp15.fgt_exec[FGTREG_HFGITR], HFGITR_EL2, ERET)) { | |
99 | if (arm_feature(env, ARM_FEATURE_EL2) && cpu_isar_feature(aa64_vh, cpu)) { | 81 | DP_TBFLAG_A64(flags, FGT_ERET, 1); |
100 | define_arm_cp_regs(cpu, vhe_reginfo); | 82 | } |
83 | + if (fgt_svc(env, el)) { | ||
84 | + DP_TBFLAG_ANY(flags, FGT_SVC, 1); | ||
85 | + } | ||
86 | } | ||
87 | |||
88 | if (cpu_isar_feature(aa64_mte, env_archcpu(env))) { | ||
101 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 89 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
102 | index XXXXXXX..XXXXXXX 100644 | 90 | index XXXXXXX..XXXXXXX 100644 |
103 | --- a/target/arm/translate-a64.c | 91 | --- a/target/arm/translate-a64.c |
104 | +++ b/target/arm/translate-a64.c | 92 | +++ b/target/arm/translate-a64.c |
105 | @@ -XXX,XX +XXX,XX @@ static void handle_msr_i(DisasContext *s, uint32_t insn, | 93 | @@ -XXX,XX +XXX,XX @@ static void disas_exc(DisasContext *s, uint32_t insn) |
106 | s->base.is_jmp = DISAS_NEXT; | 94 | int opc = extract32(insn, 21, 3); |
107 | break; | 95 | int op2_ll = extract32(insn, 0, 5); |
108 | 96 | int imm16 = extract32(insn, 5, 16); | |
109 | + case 0x04: /* PAN */ | 97 | + uint32_t syndrome; |
110 | + if (!dc_isar_feature(aa64_pan, s) || s->current_el == 0) { | 98 | |
111 | + goto do_unallocated; | 99 | switch (opc) { |
100 | case 0: | ||
101 | @@ -XXX,XX +XXX,XX @@ static void disas_exc(DisasContext *s, uint32_t insn) | ||
102 | */ | ||
103 | switch (op2_ll) { | ||
104 | case 1: /* SVC */ | ||
105 | + syndrome = syn_aa64_svc(imm16); | ||
106 | + if (s->fgt_svc) { | ||
107 | + gen_exception_insn_el(s, 0, EXCP_UDEF, syndrome, 2); | ||
108 | + break; | ||
109 | + } | ||
110 | gen_ss_advance(s); | ||
111 | - gen_exception_insn(s, 4, EXCP_SWI, syn_aa64_svc(imm16)); | ||
112 | + gen_exception_insn(s, 4, EXCP_SWI, syndrome); | ||
113 | break; | ||
114 | case 2: /* HVC */ | ||
115 | if (s->current_el == 0) { | ||
116 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, | ||
117 | dc->align_mem = EX_TBFLAG_ANY(tb_flags, ALIGN_MEM); | ||
118 | dc->pstate_il = EX_TBFLAG_ANY(tb_flags, PSTATE__IL); | ||
119 | dc->fgt_active = EX_TBFLAG_ANY(tb_flags, FGT_ACTIVE); | ||
120 | + dc->fgt_svc = EX_TBFLAG_ANY(tb_flags, FGT_SVC); | ||
121 | dc->fgt_eret = EX_TBFLAG_A64(tb_flags, FGT_ERET); | ||
122 | dc->sve_excp_el = EX_TBFLAG_A64(tb_flags, SVEEXC_EL); | ||
123 | dc->sme_excp_el = EX_TBFLAG_A64(tb_flags, SMEEXC_EL); | ||
124 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
125 | index XXXXXXX..XXXXXXX 100644 | ||
126 | --- a/target/arm/translate.c | ||
127 | +++ b/target/arm/translate.c | ||
128 | @@ -XXX,XX +XXX,XX @@ static bool trans_SVC(DisasContext *s, arg_SVC *a) | ||
129 | (a->imm == semihost_imm)) { | ||
130 | gen_exception_internal_insn(s, EXCP_SEMIHOST); | ||
131 | } else { | ||
132 | - gen_update_pc(s, curr_insn_len(s)); | ||
133 | - s->svc_imm = a->imm; | ||
134 | - s->base.is_jmp = DISAS_SWI; | ||
135 | + if (s->fgt_svc) { | ||
136 | + uint32_t syndrome = syn_aa32_svc(a->imm, s->thumb); | ||
137 | + gen_exception_insn_el(s, 0, EXCP_UDEF, syndrome, 2); | ||
138 | + } else { | ||
139 | + gen_update_pc(s, curr_insn_len(s)); | ||
140 | + s->svc_imm = a->imm; | ||
141 | + s->base.is_jmp = DISAS_SWI; | ||
112 | + } | 142 | + } |
113 | + if (crm & 1) { | 143 | } |
114 | + set_pstate_bits(PSTATE_PAN); | 144 | return true; |
115 | + } else { | 145 | } |
116 | + clear_pstate_bits(PSTATE_PAN); | 146 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) |
117 | + } | 147 | dc->align_mem = EX_TBFLAG_ANY(tb_flags, ALIGN_MEM); |
118 | + t1 = tcg_const_i32(s->current_el); | 148 | dc->pstate_il = EX_TBFLAG_ANY(tb_flags, PSTATE__IL); |
119 | + gen_helper_rebuild_hflags_a64(cpu_env, t1); | 149 | dc->fgt_active = EX_TBFLAG_ANY(tb_flags, FGT_ACTIVE); |
120 | + tcg_temp_free_i32(t1); | 150 | + dc->fgt_svc = EX_TBFLAG_ANY(tb_flags, FGT_SVC); |
121 | + break; | 151 | |
122 | + | 152 | if (arm_feature(env, ARM_FEATURE_M)) { |
123 | case 0x05: /* SPSel */ | 153 | dc->vfp_enabled = 1; |
124 | if (s->current_el == 0) { | ||
125 | goto do_unallocated; | ||
126 | -- | 154 | -- |
127 | 2.20.1 | 155 | 2.34.1 |
128 | |||
129 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
2 | 1 | ||
3 | This includes enablement of ARMv8.1-PAN. | ||
4 | |||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20200208125816.14954-17-richard.henderson@linaro.org | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | target/arm/cpu.c | 4 ++++ | ||
11 | target/arm/cpu64.c | 5 +++++ | ||
12 | 2 files changed, 9 insertions(+) | ||
13 | |||
14 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/cpu.c | ||
17 | +++ b/target/arm/cpu.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static void arm_max_initfn(Object *obj) | ||
19 | t = FIELD_DP32(t, MVFR2, FPMISC, 4); /* FP MaxNum */ | ||
20 | cpu->isar.mvfr2 = t; | ||
21 | |||
22 | + t = cpu->id_mmfr3; | ||
23 | + t = FIELD_DP32(t, ID_MMFR3, PAN, 2); /* ATS1E1 */ | ||
24 | + cpu->id_mmfr3 = t; | ||
25 | + | ||
26 | t = cpu->id_mmfr4; | ||
27 | t = FIELD_DP32(t, ID_MMFR4, HPDS, 1); /* AA32HPD */ | ||
28 | cpu->id_mmfr4 = t; | ||
29 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | ||
30 | index XXXXXXX..XXXXXXX 100644 | ||
31 | --- a/target/arm/cpu64.c | ||
32 | +++ b/target/arm/cpu64.c | ||
33 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | ||
34 | t = FIELD_DP64(t, ID_AA64MMFR1, HPDS, 1); /* HPD */ | ||
35 | t = FIELD_DP64(t, ID_AA64MMFR1, LO, 1); | ||
36 | t = FIELD_DP64(t, ID_AA64MMFR1, VH, 1); | ||
37 | + t = FIELD_DP64(t, ID_AA64MMFR1, PAN, 2); /* ATS1E1 */ | ||
38 | cpu->isar.id_aa64mmfr1 = t; | ||
39 | |||
40 | /* Replicate the same data to the 32-bit id registers. */ | ||
41 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | ||
42 | u = FIELD_DP32(u, ID_ISAR6, SPECRES, 1); | ||
43 | cpu->isar.id_isar6 = u; | ||
44 | |||
45 | + u = cpu->id_mmfr3; | ||
46 | + u = FIELD_DP32(u, ID_MMFR3, PAN, 2); /* ATS1E1 */ | ||
47 | + cpu->id_mmfr3 = u; | ||
48 | + | ||
49 | /* | ||
50 | * FIXME: We do not yet support ARMv8.2-fp16 for AArch32 yet, | ||
51 | * so do not set MVFR1.FPHP. Strictly speaking this is not legal, | ||
52 | -- | ||
53 | 2.20.1 | ||
54 | |||
55 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Chen Qun <kuhn.chenqun@huawei.com> | ||
2 | 1 | ||
3 | It's easy to reproduce as follow: | ||
4 | virsh qemu-monitor-command vm1 --pretty '{"execute": "device-list-properties", | ||
5 | "arguments":{"typename":"exynos4210.uart"}}' | ||
6 | |||
7 | ASAN shows memory leak stack: | ||
8 | #1 0xfffd896d71cb in g_malloc0 (/lib64/libglib-2.0.so.0+0x571cb) | ||
9 | #2 0xaaad270beee3 in timer_new_full /qemu/include/qemu/timer.h:530 | ||
10 | #3 0xaaad270beee3 in timer_new /qemu/include/qemu/timer.h:551 | ||
11 | #4 0xaaad270beee3 in timer_new_ns /qemu/include/qemu/timer.h:569 | ||
12 | #5 0xaaad270beee3 in exynos4210_uart_init /qemu/hw/char/exynos4210_uart.c:677 | ||
13 | #6 0xaaad275c8f4f in object_initialize_with_type /qemu/qom/object.c:516 | ||
14 | #7 0xaaad275c91bb in object_new_with_type /qemu/qom/object.c:684 | ||
15 | #8 0xaaad2755df2f in qmp_device_list_properties /qemu/qom/qom-qmp-cmds.c:152 | ||
16 | |||
17 | Reported-by: Euler Robot <euler.robot@huawei.com> | ||
18 | Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com> | ||
19 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
20 | Message-id: 20200213025603.149432-1-kuhn.chenqun@huawei.com | ||
21 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
22 | --- | ||
23 | hw/char/exynos4210_uart.c | 5 +++-- | ||
24 | 1 file changed, 3 insertions(+), 2 deletions(-) | ||
25 | |||
26 | diff --git a/hw/char/exynos4210_uart.c b/hw/char/exynos4210_uart.c | ||
27 | index XXXXXXX..XXXXXXX 100644 | ||
28 | --- a/hw/char/exynos4210_uart.c | ||
29 | +++ b/hw/char/exynos4210_uart.c | ||
30 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_uart_init(Object *obj) | ||
31 | SysBusDevice *dev = SYS_BUS_DEVICE(obj); | ||
32 | Exynos4210UartState *s = EXYNOS4210_UART(dev); | ||
33 | |||
34 | - s->fifo_timeout_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, | ||
35 | - exynos4210_uart_timeout_int, s); | ||
36 | s->wordtime = NANOSECONDS_PER_SECOND * 10 / 9600; | ||
37 | |||
38 | /* memory mapping */ | ||
39 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_uart_realize(DeviceState *dev, Error **errp) | ||
40 | { | ||
41 | Exynos4210UartState *s = EXYNOS4210_UART(dev); | ||
42 | |||
43 | + s->fifo_timeout_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, | ||
44 | + exynos4210_uart_timeout_int, s); | ||
45 | + | ||
46 | qemu_chr_fe_set_handlers(&s->chr, exynos4210_uart_can_receive, | ||
47 | exynos4210_uart_receive, exynos4210_uart_event, | ||
48 | NULL, s, NULL, true); | ||
49 | -- | ||
50 | 2.20.1 | ||
51 | |||
52 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
2 | 1 | ||
3 | When booting without device tree, the Linux kernels uses the $R1 | ||
4 | register to determine the machine type. The list of values is | ||
5 | registered at [1]. | ||
6 | |||
7 | There are two entries for the Raspberry Pi: | ||
8 | |||
9 | - https://www.arm.linux.org.uk/developer/machines/list.php?mid=3138 | ||
10 | name: MACH_TYPE_BCM2708 | ||
11 | value: 0xc42 (3138) | ||
12 | status: Active, not mainlined | ||
13 | date: 15 Oct 2010 | ||
14 | |||
15 | - https://www.arm.linux.org.uk/developer/machines/list.php?mid=4828 | ||
16 | name: MACH_TYPE_BCM2835 | ||
17 | value: 4828 | ||
18 | status: Active, mainlined | ||
19 | date: 6 Dec 2013 | ||
20 | |||
21 | QEMU always used the non-mainlined type MACH_TYPE_BCM2708. | ||
22 | The value 0xc43 is registered to 'MX51_GGC' (processor i.MX51), and | ||
23 | 0xc44 to 'Western Digital Sharespace NAS' (processor Marvell 88F5182). | ||
24 | |||
25 | The Raspberry Pi foundation bootloader only sets the BCM2708 machine | ||
26 | type, see [2] or [3]: | ||
27 | |||
28 | 133 9: | ||
29 | 134 mov r0, #0 | ||
30 | 135 ldr r1, =3138 @ BCM2708 machine id | ||
31 | 136 ldr r2, atags @ ATAGS | ||
32 | 137 bx r4 | ||
33 | |||
34 | U-Boot only uses MACH_TYPE_BCM2708 (see [4]): | ||
35 | |||
36 | 25 /* | ||
37 | 26 * 2835 is a SKU in a series for which the 2708 is the first or primary SoC, | ||
38 | 27 * so 2708 has historically been used rather than a dedicated 2835 ID. | ||
39 | 28 * | ||
40 | 29 * We don't define a machine type for bcm2709/bcm2836 since the RPi Foundation | ||
41 | 30 * chose to use someone else's previously registered machine ID (3139, MX51_GGC) | ||
42 | 31 * rather than obtaining a valid ID:-/ | ||
43 | 32 * | ||
44 | 33 * For the bcm2837, hopefully a machine type is not needed, since everything | ||
45 | 34 * is DT. | ||
46 | 35 */ | ||
47 | |||
48 | While the definition MACH_BCM2709 with value 0xc43 was introduced in | ||
49 | a commit described "Add 2709 platform for Raspberry Pi 2" out of the | ||
50 | mainline Linux kernel, it does not seem used, and the platform is | ||
51 | introduced with Device Tree support anyway (see [5] and [6]). | ||
52 | |||
53 | Remove the unused values (0xc43 introduced in commit 1df7d1f9303aef | ||
54 | "raspi: add raspberry pi 2 machine" and 0xc44 in commit bade58166f4 | ||
55 | "raspi: Raspberry Pi 3 support"), keeping only MACH_TYPE_BCM2708. | ||
56 | |||
57 | [1] https://www.arm.linux.org.uk/developer/machines/ | ||
58 | [2] https://github.com/raspberrypi/tools/blob/920c7ed2e/armstubs/armstub7.S#L135 | ||
59 | [3] https://github.com/raspberrypi/tools/blob/49719d554/armstubs/armstub7.S#L64 | ||
60 | [4] https://gitlab.denx.de/u-boot/u-boot/blob/v2015.04/include/configs/rpi-common.h#L18 | ||
61 | [5] https://github.com/raspberrypi/linux/commit/d9fac63adac#diff-6722037d79570df5b392a49e0e006573R526 | ||
62 | [6] http://lists.infradead.org/pipermail/linux-rpi-kernel/2015-February/001268.html | ||
63 | |||
64 | Cc: Zoltán Baldaszti <bztemail@gmail.com> | ||
65 | Cc: Pekka Enberg <penberg@iki.fi> | ||
66 | Cc: Stephen Warren <swarren@nvidia.com> | ||
67 | Cc: Kshitij Soni <kshitij.soni@broadcom.com> | ||
68 | Cc: Michael Chan <michael.chan@broadcom.com> | ||
69 | Cc: Andrew Baumann <Andrew.Baumann@microsoft.com> | ||
70 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
71 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
72 | Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com> | ||
73 | Message-id: 20200208165645.15657-2-f4bug@amsat.org | ||
74 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
75 | --- | ||
76 | hw/arm/raspi.c | 6 +++--- | ||
77 | 1 file changed, 3 insertions(+), 3 deletions(-) | ||
78 | |||
79 | diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c | ||
80 | index XXXXXXX..XXXXXXX 100644 | ||
81 | --- a/hw/arm/raspi.c | ||
82 | +++ b/hw/arm/raspi.c | ||
83 | @@ -XXX,XX +XXX,XX @@ | ||
84 | #define FIRMWARE_ADDR_3 0x80000 /* Pi 3 loads kernel.img here by default */ | ||
85 | #define SPINTABLE_ADDR 0xd8 /* Pi 3 bootloader spintable */ | ||
86 | |||
87 | -/* Table of Linux board IDs for different Pi versions */ | ||
88 | -static const int raspi_boardid[] = {[1] = 0xc42, [2] = 0xc43, [3] = 0xc44}; | ||
89 | +/* Registered machine type (matches RPi Foundation bootloader and U-Boot) */ | ||
90 | +#define MACH_TYPE_BCM2708 3138 | ||
91 | |||
92 | typedef struct RasPiState { | ||
93 | BCM283XState soc; | ||
94 | @@ -XXX,XX +XXX,XX @@ static void setup_boot(MachineState *machine, int version, size_t ram_size) | ||
95 | static struct arm_boot_info binfo; | ||
96 | int r; | ||
97 | |||
98 | - binfo.board_id = raspi_boardid[version]; | ||
99 | + binfo.board_id = MACH_TYPE_BCM2708; | ||
100 | binfo.ram_size = ram_size; | ||
101 | binfo.nb_cpus = machine->smp.cpus; | ||
102 | |||
103 | -- | ||
104 | 2.20.1 | ||
105 | |||
106 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
2 | 1 | ||
3 | We hardcode the board revision as 0xa21041 for the raspi2, and | ||
4 | 0xa02082 for the raspi3: | ||
5 | |||
6 | 166 static void raspi_init(MachineState *machine, int version) | ||
7 | 167 { | ||
8 | ... | ||
9 | 194 int board_rev = version == 3 ? 0xa02082 : 0xa21041; | ||
10 | |||
11 | These revision codes are for the 2B and 3B models, see: | ||
12 | https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md | ||
13 | |||
14 | Correct the board description. | ||
15 | |||
16 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
17 | Message-id: 20200208165645.15657-3-f4bug@amsat.org | ||
18 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
20 | --- | ||
21 | hw/arm/raspi.c | 4 ++-- | ||
22 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
23 | |||
24 | diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c | ||
25 | index XXXXXXX..XXXXXXX 100644 | ||
26 | --- a/hw/arm/raspi.c | ||
27 | +++ b/hw/arm/raspi.c | ||
28 | @@ -XXX,XX +XXX,XX @@ static void raspi2_init(MachineState *machine) | ||
29 | |||
30 | static void raspi2_machine_init(MachineClass *mc) | ||
31 | { | ||
32 | - mc->desc = "Raspberry Pi 2"; | ||
33 | + mc->desc = "Raspberry Pi 2B"; | ||
34 | mc->init = raspi2_init; | ||
35 | mc->block_default_type = IF_SD; | ||
36 | mc->no_parallel = 1; | ||
37 | @@ -XXX,XX +XXX,XX @@ static void raspi3_init(MachineState *machine) | ||
38 | |||
39 | static void raspi3_machine_init(MachineClass *mc) | ||
40 | { | ||
41 | - mc->desc = "Raspberry Pi 3"; | ||
42 | + mc->desc = "Raspberry Pi 3B"; | ||
43 | mc->init = raspi3_init; | ||
44 | mc->block_default_type = IF_SD; | ||
45 | mc->no_parallel = 1; | ||
46 | -- | ||
47 | 2.20.1 | ||
48 | |||
49 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | FEAT_FGT also implements an extra trap bit in the MDCR_EL2 and |
---|---|---|---|
2 | MDCR_EL3 registers: bit TDCC enables trapping of use of the Debug | ||
3 | Comms Channel registers OSDTRRX_EL1, OSDTRTX_EL1, MDCCSR_EL0, | ||
4 | MDCCINT_EL0, DBGDTR_EL0, DBGDTRRX_EL0 and DBGDTRTX_EL0 (and their | ||
5 | AArch32 equivalents). This trapping is independent of whether | ||
6 | fine-grained traps are enabled or not. | ||
2 | 7 | ||
3 | The board revision encode the processor type. Add a helper | 8 | Implement these extra traps. (We don't implement DBGDTR_EL0, |
4 | to extract the type, and use it. | 9 | DBGDTRRX_EL0 and DBGDTRTX_EL0.) |
5 | 10 | ||
6 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
7 | Message-id: 20200208165645.15657-6-f4bug@amsat.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
13 | Tested-by: Fuad Tabba <tabba@google.com> | ||
14 | Message-id: 20230130182459.3309057-23-peter.maydell@linaro.org | ||
15 | Message-id: 20230127175507.2895013-23-peter.maydell@linaro.org | ||
10 | --- | 16 | --- |
11 | hw/arm/raspi.c | 18 ++++++++++++++++-- | 17 | target/arm/debug_helper.c | 35 +++++++++++++++++++++++++++++++---- |
12 | 1 file changed, 16 insertions(+), 2 deletions(-) | 18 | 1 file changed, 31 insertions(+), 4 deletions(-) |
13 | 19 | ||
14 | diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c | 20 | diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c |
15 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/arm/raspi.c | 22 | --- a/target/arm/debug_helper.c |
17 | +++ b/hw/arm/raspi.c | 23 | +++ b/target/arm/debug_helper.c |
18 | @@ -XXX,XX +XXX,XX @@ static int board_version(uint32_t board_rev) | 24 | @@ -XXX,XX +XXX,XX @@ static CPAccessResult access_tda(CPUARMState *env, const ARMCPRegInfo *ri, |
19 | return board_processor_id(board_rev) + 1; | 25 | return CP_ACCESS_OK; |
20 | } | 26 | } |
21 | 27 | ||
22 | +static const char *board_soc_type(uint32_t board_rev) | 28 | +/* |
29 | + * Check for traps to Debug Comms Channel registers. If FEAT_FGT | ||
30 | + * is implemented then these are controlled by MDCR_EL2.TDCC for | ||
31 | + * EL2 and MDCR_EL3.TDCC for EL3. They are also controlled by | ||
32 | + * the general debug access trap bits MDCR_EL2.TDA and MDCR_EL3.TDA. | ||
33 | + */ | ||
34 | +static CPAccessResult access_tdcc(CPUARMState *env, const ARMCPRegInfo *ri, | ||
35 | + bool isread) | ||
23 | +{ | 36 | +{ |
24 | + static const char *soc_types[] = { | 37 | + int el = arm_current_el(env); |
25 | + NULL, TYPE_BCM2836, TYPE_BCM2837, | 38 | + uint64_t mdcr_el2 = arm_mdcr_el2_eff(env); |
26 | + }; | 39 | + bool mdcr_el2_tda = (mdcr_el2 & MDCR_TDA) || (mdcr_el2 & MDCR_TDE) || |
27 | + int proc_id = board_processor_id(board_rev); | 40 | + (arm_hcr_el2_eff(env) & HCR_TGE); |
41 | + bool mdcr_el2_tdcc = cpu_isar_feature(aa64_fgt, env_archcpu(env)) && | ||
42 | + (mdcr_el2 & MDCR_TDCC); | ||
43 | + bool mdcr_el3_tdcc = cpu_isar_feature(aa64_fgt, env_archcpu(env)) && | ||
44 | + (env->cp15.mdcr_el3 & MDCR_TDCC); | ||
28 | + | 45 | + |
29 | + if (proc_id >= ARRAY_SIZE(soc_types) || !soc_types[proc_id]) { | 46 | + if (el < 2 && (mdcr_el2_tda || mdcr_el2_tdcc)) { |
30 | + error_report("Unsupported processor id '%d' (board revision: 0x%x)", | 47 | + return CP_ACCESS_TRAP_EL2; |
31 | + proc_id, board_rev); | ||
32 | + exit(1); | ||
33 | + } | 48 | + } |
34 | + return soc_types[proc_id]; | 49 | + if (el < 3 && ((env->cp15.mdcr_el3 & MDCR_TDA) || mdcr_el3_tdcc)) { |
50 | + return CP_ACCESS_TRAP_EL3; | ||
51 | + } | ||
52 | + return CP_ACCESS_OK; | ||
35 | +} | 53 | +} |
36 | + | 54 | + |
37 | static void write_smpboot(ARMCPU *cpu, const struct arm_boot_info *info) | 55 | static void oslar_write(CPUARMState *env, const ARMCPRegInfo *ri, |
56 | uint64_t value) | ||
38 | { | 57 | { |
39 | static const uint32_t smpboot[] = { | 58 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo debug_cp_reginfo[] = { |
40 | @@ -XXX,XX +XXX,XX @@ static void raspi_init(MachineState *machine, uint32_t board_rev) | 59 | */ |
41 | } | 60 | { .name = "MDCCSR_EL0", .state = ARM_CP_STATE_AA64, |
42 | 61 | .opc0 = 2, .opc1 = 3, .crn = 0, .crm = 1, .opc2 = 0, | |
43 | object_initialize_child(OBJECT(machine), "soc", &s->soc, sizeof(s->soc), | 62 | - .access = PL0_R, .accessfn = access_tda, |
44 | - version == 3 ? TYPE_BCM2837 : TYPE_BCM2836, | 63 | + .access = PL0_R, .accessfn = access_tdcc, |
45 | - &error_abort, NULL); | 64 | .type = ARM_CP_CONST, .resetvalue = 0 }, |
46 | + board_soc_type(board_rev), &error_abort, NULL); | 65 | /* |
47 | 66 | * OSDTRRX_EL1/OSDTRTX_EL1 are used for save and restore of DBGDTRRX_EL0. | |
48 | /* Allocate and map RAM */ | 67 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo debug_cp_reginfo[] = { |
49 | memory_region_allocate_system_memory(&s->ram, OBJECT(machine), "ram", | 68 | */ |
69 | { .name = "OSDTRRX_EL1", .state = ARM_CP_STATE_BOTH, .cp = 14, | ||
70 | .opc0 = 2, .opc1 = 0, .crn = 0, .crm = 0, .opc2 = 2, | ||
71 | - .access = PL1_RW, .accessfn = access_tda, | ||
72 | + .access = PL1_RW, .accessfn = access_tdcc, | ||
73 | .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
74 | { .name = "OSDTRTX_EL1", .state = ARM_CP_STATE_BOTH, .cp = 14, | ||
75 | .opc0 = 2, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 2, | ||
76 | - .access = PL1_RW, .accessfn = access_tda, | ||
77 | + .access = PL1_RW, .accessfn = access_tdcc, | ||
78 | .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
79 | /* | ||
80 | * OSECCR_EL1 provides a mechanism for an operating system | ||
81 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo debug_cp_reginfo[] = { | ||
82 | */ | ||
83 | { .name = "MDCCINT_EL1", .state = ARM_CP_STATE_BOTH, | ||
84 | .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 0, | ||
85 | - .access = PL1_RW, .accessfn = access_tda, | ||
86 | + .access = PL1_RW, .accessfn = access_tdcc, | ||
87 | .type = ARM_CP_NOP }, | ||
88 | /* | ||
89 | * Dummy DBGCLAIM registers. | ||
50 | -- | 90 | -- |
51 | 2.20.1 | 91 | 2.34.1 |
52 | |||
53 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
2 | 1 | ||
3 | QOM'ify RaspiMachineState. Now machines inherit of RaspiMachineClass. | ||
4 | |||
5 | Cc: Igor Mammedov <imammedo@redhat.com> | ||
6 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
7 | Acked-by: Igor Mammedov <imammedo@redhat.com> | ||
8 | Message-id: 20200208165645.15657-8-f4bug@amsat.org | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | hw/arm/raspi.c | 56 +++++++++++++++++++++++++++++++++++++++++++------- | ||
13 | 1 file changed, 49 insertions(+), 7 deletions(-) | ||
14 | |||
15 | diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/hw/arm/raspi.c | ||
18 | +++ b/hw/arm/raspi.c | ||
19 | @@ -XXX,XX +XXX,XX @@ | ||
20 | /* Registered machine type (matches RPi Foundation bootloader and U-Boot) */ | ||
21 | #define MACH_TYPE_BCM2708 3138 | ||
22 | |||
23 | -typedef struct RasPiState { | ||
24 | +typedef struct RaspiMachineState { | ||
25 | + /*< private >*/ | ||
26 | + MachineState parent_obj; | ||
27 | + /*< public >*/ | ||
28 | BCM283XState soc; | ||
29 | MemoryRegion ram; | ||
30 | -} RasPiState; | ||
31 | +} RaspiMachineState; | ||
32 | + | ||
33 | +typedef struct RaspiMachineClass { | ||
34 | + /*< private >*/ | ||
35 | + MachineClass parent_obj; | ||
36 | + /*< public >*/ | ||
37 | +} RaspiMachineClass; | ||
38 | + | ||
39 | +#define TYPE_RASPI_MACHINE MACHINE_TYPE_NAME("raspi-common") | ||
40 | +#define RASPI_MACHINE(obj) \ | ||
41 | + OBJECT_CHECK(RaspiMachineState, (obj), TYPE_RASPI_MACHINE) | ||
42 | + | ||
43 | +#define RASPI_MACHINE_CLASS(klass) \ | ||
44 | + OBJECT_CLASS_CHECK(RaspiMachineClass, (klass), TYPE_RASPI_MACHINE) | ||
45 | +#define RASPI_MACHINE_GET_CLASS(obj) \ | ||
46 | + OBJECT_GET_CLASS(RaspiMachineClass, (obj), TYPE_RASPI_MACHINE) | ||
47 | |||
48 | /* | ||
49 | * Board revision codes: | ||
50 | @@ -XXX,XX +XXX,XX @@ static void setup_boot(MachineState *machine, int version, size_t ram_size) | ||
51 | |||
52 | static void raspi_init(MachineState *machine, uint32_t board_rev) | ||
53 | { | ||
54 | - RasPiState *s = g_new0(RasPiState, 1); | ||
55 | + RaspiMachineState *s = RASPI_MACHINE(machine); | ||
56 | int version = board_version(board_rev); | ||
57 | uint64_t ram_size = board_ram_size(board_rev); | ||
58 | uint32_t vcram_size; | ||
59 | @@ -XXX,XX +XXX,XX @@ static void raspi2_init(MachineState *machine) | ||
60 | raspi_init(machine, 0xa21041); | ||
61 | } | ||
62 | |||
63 | -static void raspi2_machine_init(MachineClass *mc) | ||
64 | +static void raspi2_machine_class_init(ObjectClass *oc, void *data) | ||
65 | { | ||
66 | + MachineClass *mc = MACHINE_CLASS(oc); | ||
67 | + | ||
68 | mc->desc = "Raspberry Pi 2B"; | ||
69 | mc->init = raspi2_init; | ||
70 | mc->block_default_type = IF_SD; | ||
71 | @@ -XXX,XX +XXX,XX @@ static void raspi2_machine_init(MachineClass *mc) | ||
72 | mc->default_ram_size = 1 * GiB; | ||
73 | mc->ignore_memory_transaction_failures = true; | ||
74 | }; | ||
75 | -DEFINE_MACHINE("raspi2", raspi2_machine_init) | ||
76 | |||
77 | #ifdef TARGET_AARCH64 | ||
78 | static void raspi3_init(MachineState *machine) | ||
79 | @@ -XXX,XX +XXX,XX @@ static void raspi3_init(MachineState *machine) | ||
80 | raspi_init(machine, 0xa02082); | ||
81 | } | ||
82 | |||
83 | -static void raspi3_machine_init(MachineClass *mc) | ||
84 | +static void raspi3_machine_class_init(ObjectClass *oc, void *data) | ||
85 | { | ||
86 | + MachineClass *mc = MACHINE_CLASS(oc); | ||
87 | + | ||
88 | mc->desc = "Raspberry Pi 3B"; | ||
89 | mc->init = raspi3_init; | ||
90 | mc->block_default_type = IF_SD; | ||
91 | @@ -XXX,XX +XXX,XX @@ static void raspi3_machine_init(MachineClass *mc) | ||
92 | mc->default_cpus = BCM283X_NCPUS; | ||
93 | mc->default_ram_size = 1 * GiB; | ||
94 | } | ||
95 | -DEFINE_MACHINE("raspi3", raspi3_machine_init) | ||
96 | #endif | ||
97 | + | ||
98 | +static const TypeInfo raspi_machine_types[] = { | ||
99 | + { | ||
100 | + .name = MACHINE_TYPE_NAME("raspi2"), | ||
101 | + .parent = TYPE_RASPI_MACHINE, | ||
102 | + .class_init = raspi2_machine_class_init, | ||
103 | +#ifdef TARGET_AARCH64 | ||
104 | + }, { | ||
105 | + .name = MACHINE_TYPE_NAME("raspi3"), | ||
106 | + .parent = TYPE_RASPI_MACHINE, | ||
107 | + .class_init = raspi3_machine_class_init, | ||
108 | +#endif | ||
109 | + }, { | ||
110 | + .name = TYPE_RASPI_MACHINE, | ||
111 | + .parent = TYPE_MACHINE, | ||
112 | + .instance_size = sizeof(RaspiMachineState), | ||
113 | + .class_size = sizeof(RaspiMachineClass), | ||
114 | + .abstract = true, | ||
115 | + } | ||
116 | +}; | ||
117 | + | ||
118 | +DEFINE_TYPES(raspi_machine_types) | ||
119 | -- | ||
120 | 2.20.1 | ||
121 | |||
122 | diff view generated by jsdifflib |
1 | The ARMv8.1-VMID16 extension extends the VMID from 8 bits to 16 bits: | 1 | Update the ID registers for TCG's '-cpu max' to report the |
---|---|---|---|
2 | 2 | presence of FEAT_FGT Fine-Grained Traps support. | |
3 | * the ID_AA64MMFR1_EL1.VMIDBits field specifies whether the VMID is | ||
4 | 8 or 16 bits | ||
5 | * the VMID field in VTTBR_EL2 is extended to 16 bits | ||
6 | * VTCR_EL2.VS lets the guest specify whether to use the full 16 bits, | ||
7 | or use the backwards-compatible 8 bits | ||
8 | |||
9 | For QEMU implementing this is trivial: | ||
10 | * we do not track VMIDs in TLB entries, so we never use the VMID field | ||
11 | * we treat any write to VTTBR_EL2, not just a change to the VMID field | ||
12 | bits, as a "possible VMID change" that causes us to throw away TLB | ||
13 | entries, so that code doesn't need changing | ||
14 | * we allow the guest to read/write the VTCR_EL2.VS bit already | ||
15 | |||
16 | So all that's missing is the ID register part: report that we support | ||
17 | VMID16 in our 'max' CPU. | ||
18 | 3 | ||
19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
20 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
21 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
22 | Message-id: 20200210120146.17631-1-peter.maydell@linaro.org | 6 | Tested-by: Fuad Tabba <tabba@google.com> |
7 | Message-id: 20230130182459.3309057-24-peter.maydell@linaro.org | ||
8 | Message-id: 20230127175507.2895013-24-peter.maydell@linaro.org | ||
23 | --- | 9 | --- |
24 | target/arm/cpu64.c | 1 + | 10 | docs/system/arm/emulation.rst | 1 + |
25 | 1 file changed, 1 insertion(+) | 11 | target/arm/cpu64.c | 1 + |
12 | 2 files changed, 2 insertions(+) | ||
26 | 13 | ||
14 | diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/docs/system/arm/emulation.rst | ||
17 | +++ b/docs/system/arm/emulation.rst | ||
18 | @@ -XXX,XX +XXX,XX @@ the following architecture extensions: | ||
19 | - FEAT_ETS (Enhanced Translation Synchronization) | ||
20 | - FEAT_EVT (Enhanced Virtualization Traps) | ||
21 | - FEAT_FCMA (Floating-point complex number instructions) | ||
22 | +- FEAT_FGT (Fine-Grained Traps) | ||
23 | - FEAT_FHM (Floating-point half-precision multiplication instructions) | ||
24 | - FEAT_FP16 (Half-precision floating-point data processing) | ||
25 | - FEAT_FRINTTS (Floating-point to integer instructions) | ||
27 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | 26 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c |
28 | index XXXXXXX..XXXXXXX 100644 | 27 | index XXXXXXX..XXXXXXX 100644 |
29 | --- a/target/arm/cpu64.c | 28 | --- a/target/arm/cpu64.c |
30 | +++ b/target/arm/cpu64.c | 29 | +++ b/target/arm/cpu64.c |
31 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | 30 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) |
32 | t = FIELD_DP64(t, ID_AA64MMFR1, LO, 1); | 31 | t = FIELD_DP64(t, ID_AA64MMFR0, TGRAN16_2, 2); /* 16k stage2 supported */ |
33 | t = FIELD_DP64(t, ID_AA64MMFR1, VH, 1); | 32 | t = FIELD_DP64(t, ID_AA64MMFR0, TGRAN64_2, 2); /* 64k stage2 supported */ |
34 | t = FIELD_DP64(t, ID_AA64MMFR1, PAN, 2); /* ATS1E1 */ | 33 | t = FIELD_DP64(t, ID_AA64MMFR0, TGRAN4_2, 2); /* 4k stage2 supported */ |
35 | + t = FIELD_DP64(t, ID_AA64MMFR1, VMIDBITS, 2); /* VMID16 */ | 34 | + t = FIELD_DP64(t, ID_AA64MMFR0, FGT, 1); /* FEAT_FGT */ |
36 | cpu->isar.id_aa64mmfr1 = t; | 35 | cpu->isar.id_aa64mmfr0 = t; |
37 | 36 | ||
38 | t = cpu->isar.id_aa64mmfr2; | 37 | t = cpu->isar.id_aa64mmfr1; |
39 | -- | 38 | -- |
40 | 2.20.1 | 39 | 2.34.1 |
41 | |||
42 | diff view generated by jsdifflib |