1 | Arm patches for rc3 : just a handful of bug fixes. | 1 | Nothing exciting here: two minor bug fixes, some fixes for |
---|---|---|---|
2 | running on a 32-bit host, and a docs tweak. | ||
2 | 3 | ||
3 | thanks | 4 | thanks |
4 | -- PMM | 5 | -- PMM |
5 | 6 | ||
7 | The following changes since commit 6af9d12c88b9720f209912f6e4b01fefe5906d59: | ||
6 | 8 | ||
7 | The following changes since commit 4ecc984210ca1bf508a96a550ec8a93a5f833f6c: | 9 | Merge tag 'migration-20240331-pull-request' of https://gitlab.com/peterx/qemu into staging (2024-04-01 13:12:40 +0100) |
8 | |||
9 | Merge remote-tracking branch 'remotes/palmer/tags/riscv-for-master-4.2-rc3' into staging (2019-11-26 12:36:40 +0000) | ||
10 | 10 | ||
11 | are available in the Git repository at: | 11 | are available in the Git repository at: |
12 | 12 | ||
13 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20191126 | 13 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20240402 |
14 | 14 | ||
15 | for you to fetch changes up to 6a4ef4e5d1084ce41fafa7d470a644b0fd3d9317: | 15 | for you to fetch changes up to 393770d7a02135e7468018f52da610712f151ec0: |
16 | 16 | ||
17 | target/arm: Honor HCR_EL2.TID3 trapping requirements (2019-11-26 13:55:37 +0000) | 17 | raspi4b: Reduce RAM to 1Gb on 32-bit hosts (2024-04-02 10:13:48 +0100) |
18 | 18 | ||
19 | ---------------------------------------------------------------- | 19 | ---------------------------------------------------------------- |
20 | target-arm queue: | 20 | target-arm queue: |
21 | * handle FTYPE flag correctly in v7M exception return | 21 | * take HSTR traps of cp15 accesses to EL2, not EL1 |
22 | for v7M CPUs with an FPU (v8M CPUs were already correct) | 22 | * docs: sbsa: update specs, add dt note |
23 | * versal: Add the CRP as unimplemented | 23 | * hw/intc/arm_gicv3: ICC_HPPIR* return SPURIOUS if int group is disabled |
24 | * Fix ISR_EL1 tracking when executing at EL2 | 24 | * tests/qtest: Fix STM32L4x5 GPIO test on 32-bit |
25 | * Honor HCR_EL2.TID3 trapping requirements | 25 | * raspi4b: Reduce RAM to 1Gb on 32-bit hosts |
26 | 26 | ||
27 | ---------------------------------------------------------------- | 27 | ---------------------------------------------------------------- |
28 | Edgar E. Iglesias (1): | 28 | Cédric Le Goater (2): |
29 | hw/arm: versal: Add the CRP as unimplemented | 29 | tests/qtest: Fix STM32L4x5 GPIO test on 32-bit |
30 | raspi4b: Reduce RAM to 1Gb on 32-bit hosts | ||
30 | 31 | ||
31 | Jean-Hugues Deschênes (1): | 32 | Marcin Juszkiewicz (1): |
32 | target/arm: Fix handling of cortex-m FTYPE flag in EXCRET | 33 | docs: sbsa: update specs, add dt note |
33 | 34 | ||
34 | Marc Zyngier (2): | 35 | Peter Maydell (2): |
35 | target/arm: Fix ISR_EL1 tracking when executing at EL2 | 36 | target/arm: take HSTR traps of cp15 accesses to EL2, not EL1 |
36 | target/arm: Honor HCR_EL2.TID3 trapping requirements | 37 | hw/intc/arm_gicv3: ICC_HPPIR* return SPURIOUS if int group is disabled |
37 | 38 | ||
38 | include/hw/arm/xlnx-versal.h | 3 ++ | 39 | docs/system/arm/sbsa.rst | 35 +++++++++++++++++------ |
39 | hw/arm/xlnx-versal.c | 2 ++ | 40 | hw/arm/raspi4b.c | 4 +++ |
40 | target/arm/helper.c | 83 ++++++++++++++++++++++++++++++++++++++++++-- | 41 | hw/intc/arm_gicv3_cpuif.c | 4 +-- |
41 | target/arm/m_helper.c | 7 ++-- | 42 | target/arm/tcg/translate.c | 2 +- |
42 | 4 files changed, 89 insertions(+), 6 deletions(-) | 43 | tests/qtest/stm32l4x5_gpio-test.c | 59 +++++++++++++++++++++++---------------- |
44 | 5 files changed, 68 insertions(+), 36 deletions(-) | ||
43 | 45 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | The HSTR_EL2 register allows the hypervisor to trap AArch32 EL1 and | ||
2 | EL0 accesses to cp15 registers. We incorrectly implemented this so | ||
3 | they trap to EL1 when we detect the need for a HSTR trap at code | ||
4 | generation time. (The check in access_check_cp_reg() which we do at | ||
5 | runtime to catch traps from EL0 is correctly routing them to EL2.) | ||
1 | 6 | ||
7 | Use the correct target EL when generating the code to take the trap. | ||
8 | |||
9 | Cc: qemu-stable@nongnu.org | ||
10 | Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2226 | ||
11 | Fixes: 049edada5e93df ("target/arm: Make HSTR_EL2 traps take priority over UNDEF-at-EL1") | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
14 | Message-id: 20240325133116.2075362-1-peter.maydell@linaro.org | ||
15 | --- | ||
16 | target/arm/tcg/translate.c | 2 +- | ||
17 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
18 | |||
19 | diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/target/arm/tcg/translate.c | ||
22 | +++ b/target/arm/tcg/translate.c | ||
23 | @@ -XXX,XX +XXX,XX @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, | ||
24 | tcg_gen_andi_i32(t, t, 1u << maskbit); | ||
25 | tcg_gen_brcondi_i32(TCG_COND_EQ, t, 0, over.label); | ||
26 | |||
27 | - gen_exception_insn(s, 0, EXCP_UDEF, syndrome); | ||
28 | + gen_exception_insn_el(s, 0, EXCP_UDEF, syndrome, 2); | ||
29 | /* | ||
30 | * gen_exception_insn() will set is_jmp to DISAS_NORETURN, | ||
31 | * but since we're conditionally branching over it, we want | ||
32 | -- | ||
33 | 2.34.1 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Add the CRP as unimplemented thus avoiding bus errors when | 3 | Hardware of sbsa-ref board is nowadays defined by both BSA and SBSA |
4 | guests access these registers. | 4 | specifications. Then BBR defines firmware interface. |
5 | 5 | ||
6 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 6 | Added note about DeviceTree data passed from QEMU to firmware. It is |
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 7 | very minimal and provides only data we use in firmware. |
8 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | 8 | |
9 | Message-id: 20191115154734.26449-2-edgar.iglesias@gmail.com | 9 | Added NUMA information to list of things reported by DeviceTree. |
10 | |||
11 | Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org> | ||
12 | Message-id: 20240328163851.1386176-1-marcin.juszkiewicz@linaro.org | ||
13 | Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com> | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 15 | --- |
12 | include/hw/arm/xlnx-versal.h | 3 +++ | 16 | docs/system/arm/sbsa.rst | 35 ++++++++++++++++++++++++++--------- |
13 | hw/arm/xlnx-versal.c | 2 ++ | 17 | 1 file changed, 26 insertions(+), 9 deletions(-) |
14 | 2 files changed, 5 insertions(+) | ||
15 | 18 | ||
16 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | 19 | diff --git a/docs/system/arm/sbsa.rst b/docs/system/arm/sbsa.rst |
17 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/include/hw/arm/xlnx-versal.h | 21 | --- a/docs/system/arm/sbsa.rst |
19 | +++ b/include/hw/arm/xlnx-versal.h | 22 | +++ b/docs/system/arm/sbsa.rst |
20 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | 23 | @@ -XXX,XX +XXX,XX @@ |
21 | #define MM_IOU_SCNTRS_SIZE 0x10000 | 24 | Arm Server Base System Architecture Reference board (``sbsa-ref``) |
22 | #define MM_FPD_CRF 0xfd1a0000U | 25 | ================================================================== |
23 | #define MM_FPD_CRF_SIZE 0x140000 | 26 | |
27 | -While the ``virt`` board is a generic board platform that doesn't match | ||
28 | -any real hardware the ``sbsa-ref`` board intends to look like real | ||
29 | -hardware. The `Server Base System Architecture | ||
30 | -<https://developer.arm.com/documentation/den0029/latest>`_ defines a | ||
31 | -minimum base line of hardware support and importantly how the firmware | ||
32 | -reports that to any operating system. | ||
33 | +The ``sbsa-ref`` board intends to look like real hardware (while the ``virt`` | ||
34 | +board is a generic board platform that doesn't match any real hardware). | ||
24 | + | 35 | + |
25 | +#define MM_PMC_CRP 0xf1260000U | 36 | +The hardware part is defined by two specifications: |
26 | +#define MM_PMC_CRP_SIZE 0x10000 | 37 | + |
27 | #endif | 38 | + - `Base System Architecture <https://developer.arm.com/documentation/den0094/>`__ (BSA) |
28 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | 39 | + - `Server Base System Architecture <https://developer.arm.com/documentation/den0029/>`__ (SBSA) |
29 | index XXXXXXX..XXXXXXX 100644 | 40 | + |
30 | --- a/hw/arm/xlnx-versal.c | 41 | +The `Arm Base Boot Requirements <https://developer.arm.com/documentation/den0044/>`__ (BBR) |
31 | +++ b/hw/arm/xlnx-versal.c | 42 | +specification defines how the firmware reports that to any operating system. |
32 | @@ -XXX,XX +XXX,XX @@ static void versal_unimp(Versal *s) | 43 | |
33 | MM_CRL, MM_CRL_SIZE); | 44 | It is intended to be a machine for developing firmware and testing |
34 | versal_unimp_area(s, "crf", &s->mr_ps, | 45 | standards compliance with operating systems. |
35 | MM_FPD_CRF, MM_FPD_CRF_SIZE); | 46 | @@ -XXX,XX +XXX,XX @@ includes both internal hardware and parts affected by the qemu command line |
36 | + versal_unimp_area(s, "crp", &s->mr_ps, | 47 | (i.e. CPUs and memory). As a result it must have a firmware specifically built |
37 | + MM_PMC_CRP, MM_PMC_CRP_SIZE); | 48 | to expect a certain hardware layout (as you would in a real machine). |
38 | versal_unimp_area(s, "iou-scntr", &s->mr_ps, | 49 | |
39 | MM_IOU_SCNTR, MM_IOU_SCNTR_SIZE); | 50 | +Note |
40 | versal_unimp_area(s, "iou-scntr-seucre", &s->mr_ps, | 51 | +'''' |
52 | + | ||
53 | +QEMU provides the guest EL3 firmware with minimal information about hardware | ||
54 | +platform using minimalistic devicetree. This is not a Linux devicetree. It is | ||
55 | +not even a firmware devicetree. | ||
56 | + | ||
57 | +It is information passed from QEMU to describe the information a hardware | ||
58 | +platform would have other mechanisms to discover at runtime, that are affected | ||
59 | +by the QEMU command line. | ||
60 | + | ||
61 | +Ultimately this devicetree may be replaced by IPC calls to an emulated SCP. | ||
62 | + | ||
63 | DeviceTree information | ||
64 | '''''''''''''''''''''' | ||
65 | |||
66 | -The devicetree provided by the board model to the firmware is not intended | ||
67 | -to be a complete compliant DT. It currently reports: | ||
68 | +The devicetree reports: | ||
69 | |||
70 | - CPUs | ||
71 | - memory | ||
72 | - platform version | ||
73 | - GIC addresses | ||
74 | + - NUMA node id for CPUs and memory | ||
75 | |||
76 | Platform version | ||
77 | '''''''''''''''' | ||
78 | @@ -XXX,XX +XXX,XX @@ Platform version changes: | ||
79 | GIC ITS information is present in devicetree. | ||
80 | |||
81 | 0.3 | ||
82 | - The USB controller is an XHCI device, not EHCI | ||
83 | + The USB controller is an XHCI device, not EHCI. | ||
41 | -- | 84 | -- |
42 | 2.20.1 | 85 | 2.34.1 |
43 | |||
44 | diff view generated by jsdifflib |
1 | From: Marc Zyngier <maz@kernel.org> | 1 | If the group of the highest priority pending interrupt is disabled |
---|---|---|---|
2 | via ICC_IGRPEN*, the ICC_HPPIR* registers should return | ||
3 | INTID_SPURIOUS, not the interrupt ID. (See the GIC architecture | ||
4 | specification pseudocode functions ICC_HPPIR1_EL1[] and | ||
5 | HighestPriorityPendingInterrupt().) | ||
2 | 6 | ||
3 | The ARMv8 ARM states when executing at EL2, EL3 or Secure EL1, | 7 | Make HPPIR reads honour the group disable, the way we already do |
4 | ISR_EL1 shows the pending status of the physical IRQ, FIQ, or | 8 | when determining whether to preempt in icc_hppi_can_preempt(). |
5 | SError interrupts. | ||
6 | 9 | ||
7 | Unfortunately, QEMU's implementation only considers the HCR_EL2 | 10 | Cc: qemu-stable@nongnu.org |
8 | bits, and ignores the current exception level. This means a hypervisor | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | trying to look at its own interrupt state actually sees the guest | 12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
10 | state, which is unexpected and breaks KVM as of Linux 5.3. | 13 | Message-id: 20240328153333.2522667-1-peter.maydell@linaro.org |
14 | --- | ||
15 | hw/intc/arm_gicv3_cpuif.c | 4 ++-- | ||
16 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
11 | 17 | ||
12 | Instead, check for the running EL and return the physical bits | 18 | diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c |
13 | if not running in a virtualized context. | ||
14 | |||
15 | Fixes: 636540e9c40b | ||
16 | Cc: qemu-stable@nongnu.org | ||
17 | Reported-by: Quentin Perret <qperret@google.com> | ||
18 | Signed-off-by: Marc Zyngier <maz@kernel.org> | ||
19 | Message-id: 20191122135833.28953-1-maz@kernel.org | ||
20 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
21 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
22 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
23 | --- | ||
24 | target/arm/helper.c | 7 +++++-- | ||
25 | 1 file changed, 5 insertions(+), 2 deletions(-) | ||
26 | |||
27 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
28 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
29 | --- a/target/arm/helper.c | 20 | --- a/hw/intc/arm_gicv3_cpuif.c |
30 | +++ b/target/arm/helper.c | 21 | +++ b/hw/intc/arm_gicv3_cpuif.c |
31 | @@ -XXX,XX +XXX,XX @@ static uint64_t isr_read(CPUARMState *env, const ARMCPRegInfo *ri) | 22 | @@ -XXX,XX +XXX,XX @@ static uint64_t icc_hppir0_value(GICv3CPUState *cs, CPUARMState *env) |
32 | CPUState *cs = env_cpu(env); | 23 | */ |
33 | uint64_t hcr_el2 = arm_hcr_el2_eff(env); | 24 | bool irq_is_secure; |
34 | uint64_t ret = 0; | 25 | |
35 | + bool allow_virt = (arm_current_el(env) == 1 && | 26 | - if (cs->hppi.prio == 0xff) { |
36 | + (!arm_is_secure_below_el3(env) || | 27 | + if (icc_no_enabled_hppi(cs)) { |
37 | + (env->cp15.scr_el3 & SCR_EEL2))); | 28 | return INTID_SPURIOUS; |
38 | |||
39 | - if (hcr_el2 & HCR_IMO) { | ||
40 | + if (allow_virt && (hcr_el2 & HCR_IMO)) { | ||
41 | if (cs->interrupt_request & CPU_INTERRUPT_VIRQ) { | ||
42 | ret |= CPSR_I; | ||
43 | } | ||
44 | @@ -XXX,XX +XXX,XX @@ static uint64_t isr_read(CPUARMState *env, const ARMCPRegInfo *ri) | ||
45 | } | ||
46 | } | 29 | } |
47 | 30 | ||
48 | - if (hcr_el2 & HCR_FMO) { | 31 | @@ -XXX,XX +XXX,XX @@ static uint64_t icc_hppir1_value(GICv3CPUState *cs, CPUARMState *env) |
49 | + if (allow_virt && (hcr_el2 & HCR_FMO)) { | 32 | */ |
50 | if (cs->interrupt_request & CPU_INTERRUPT_VFIQ) { | 33 | bool irq_is_secure; |
51 | ret |= CPSR_F; | 34 | |
52 | } | 35 | - if (cs->hppi.prio == 0xff) { |
36 | + if (icc_no_enabled_hppi(cs)) { | ||
37 | return INTID_SPURIOUS; | ||
38 | } | ||
39 | |||
53 | -- | 40 | -- |
54 | 2.20.1 | 41 | 2.34.1 |
55 | |||
56 | diff view generated by jsdifflib |
1 | From: Marc Zyngier <maz@kernel.org> | 1 | From: Cédric Le Goater <clg@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | HCR_EL2.TID3 mandates that access from EL1 to a long list of id | 3 | The test mangles the GPIO address and the pin number in the |
4 | registers traps to EL2, and QEMU has so far ignored this requirement. | 4 | qtest_add_data_func data parameter. Doing so, it assumes that the host |
5 | pointer size is always 64-bit, which breaks on 32-bit : | ||
5 | 6 | ||
6 | This breaks (among other things) KVM guests that have PtrAuth enabled, | 7 | ../tests/qtest/stm32l4x5_gpio-test.c: In function ‘test_gpio_output_mode’: |
7 | while the hypervisor doesn't want to expose the feature to its guest. | 8 | ../tests/qtest/stm32l4x5_gpio-test.c:272:25: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] |
8 | To achieve this, KVM traps the ID registers (ID_AA64ISAR1_EL1 in this | 9 | 272 | unsigned int pin = ((uint64_t)data) & 0xF; |
9 | case), and masks out the unsupported feature. | 10 | | ^ |
11 | ../tests/qtest/stm32l4x5_gpio-test.c:273:22: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] | ||
12 | 273 | uint32_t gpio = ((uint64_t)data) >> 32; | ||
13 | | ^ | ||
10 | 14 | ||
11 | QEMU not honoring the trap request means that the guest observes | 15 | To fix, improve the mangling of the GPIO address and pin number fields |
12 | that the feature is present in the HW, starts using it, and dies | 16 | by using GPIO_SIZE so that the resulting value fits in a 32-bit pointer. |
13 | a horrible death when KVM injects an UNDEF, because the feature | 17 | While at it, include some helpers to hide the details. |
14 | *really* isn't supported. | ||
15 | 18 | ||
16 | Do the right thing by trapping to EL2 if HCR_EL2.TID3 is set. | 19 | Cc: Arnaud Minier <arnaud.minier@telecom-paris.fr> |
17 | 20 | Cc: Inès Varhol <ines.varhol@telecom-paris.fr> | |
18 | Note that this change does not include trapping of the MVFR | 21 | Signed-off-by: Cédric Le Goater <clg@redhat.com> |
19 | registers from AArch32 (they are accessed via the VMRS | 22 | Message-id: 20240329092747.298259-1-clg@redhat.com |
20 | instruction and need to be handled in a different way). | ||
21 | |||
22 | Reported-by: Will Deacon <will@kernel.org> | ||
23 | Signed-off-by: Marc Zyngier <maz@kernel.org> | ||
24 | Tested-by: Will Deacon <will@kernel.org> | ||
25 | Message-id: 20191123115618.29230-1-maz@kernel.org | ||
26 | [PMM: added missing accessfn line for ID_AA4PFR2_EL1_RESERVED; | ||
27 | changed names of access functions to include _tid3] | ||
28 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 23 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
29 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 24 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
30 | --- | 25 | --- |
31 | target/arm/helper.c | 76 +++++++++++++++++++++++++++++++++++++++++++++ | 26 | tests/qtest/stm32l4x5_gpio-test.c | 59 ++++++++++++++++++------------- |
32 | 1 file changed, 76 insertions(+) | 27 | 1 file changed, 35 insertions(+), 24 deletions(-) |
33 | 28 | ||
34 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 29 | diff --git a/tests/qtest/stm32l4x5_gpio-test.c b/tests/qtest/stm32l4x5_gpio-test.c |
35 | index XXXXXXX..XXXXXXX 100644 | 30 | index XXXXXXX..XXXXXXX 100644 |
36 | --- a/target/arm/helper.c | 31 | --- a/tests/qtest/stm32l4x5_gpio-test.c |
37 | +++ b/target/arm/helper.c | 32 | +++ b/tests/qtest/stm32l4x5_gpio-test.c |
38 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo predinv_reginfo[] = { | 33 | @@ -XXX,XX +XXX,XX @@ const uint32_t idr_reset[NUM_GPIOS] = { |
39 | REGINFO_SENTINEL | 34 | 0x00000000 |
40 | }; | 35 | }; |
41 | 36 | ||
42 | +static CPAccessResult access_aa64_tid3(CPUARMState *env, const ARMCPRegInfo *ri, | 37 | +#define PIN_MASK 0xF |
43 | + bool isread) | 38 | +#define GPIO_ADDR_MASK (~(GPIO_SIZE - 1)) |
39 | + | ||
40 | +static inline void *test_data(uint32_t gpio_addr, uint8_t pin) | ||
44 | +{ | 41 | +{ |
45 | + if ((arm_current_el(env) < 2) && (arm_hcr_el2_eff(env) & HCR_TID3)) { | 42 | + return (void *)(uintptr_t)((gpio_addr & GPIO_ADDR_MASK) | (pin & PIN_MASK)); |
46 | + return CP_ACCESS_TRAP_EL2; | ||
47 | + } | ||
48 | + | ||
49 | + return CP_ACCESS_OK; | ||
50 | +} | 43 | +} |
51 | + | 44 | + |
52 | +static CPAccessResult access_aa32_tid3(CPUARMState *env, const ARMCPRegInfo *ri, | 45 | +#define test_gpio_addr(data) ((uintptr_t)(data) & GPIO_ADDR_MASK) |
53 | + bool isread) | 46 | +#define test_pin(data) ((uintptr_t)(data) & PIN_MASK) |
54 | +{ | ||
55 | + if (arm_feature(env, ARM_FEATURE_V8)) { | ||
56 | + return access_aa64_tid3(env, ri, isread); | ||
57 | + } | ||
58 | + | 47 | + |
59 | + return CP_ACCESS_OK; | 48 | static uint32_t gpio_readl(unsigned int gpio, unsigned int offset) |
60 | +} | ||
61 | + | ||
62 | void register_cp_regs_for_features(ARMCPU *cpu) | ||
63 | { | 49 | { |
64 | /* Register all the coprocessor registers based on feature bits */ | 50 | return readl(gpio + offset); |
65 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | 51 | @@ -XXX,XX +XXX,XX @@ static void test_gpio_output_mode(const void *data) |
66 | { .name = "ID_PFR0", .state = ARM_CP_STATE_BOTH, | 52 | * Additionally, it checks that values written to ODR |
67 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 0, | 53 | * when not in output mode are stored and not discarded. |
68 | .access = PL1_R, .type = ARM_CP_CONST, | 54 | */ |
69 | + .accessfn = access_aa32_tid3, | 55 | - unsigned int pin = ((uint64_t)data) & 0xF; |
70 | .resetvalue = cpu->id_pfr0 }, | 56 | - uint32_t gpio = ((uint64_t)data) >> 32; |
71 | /* ID_PFR1 is not a plain ARM_CP_CONST because we don't know | 57 | + unsigned int pin = test_pin(data); |
72 | * the value of the GIC field until after we define these regs. | 58 | + uint32_t gpio = test_gpio_addr(data); |
73 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | 59 | unsigned int gpio_id = get_gpio_id(gpio); |
74 | { .name = "ID_PFR1", .state = ARM_CP_STATE_BOTH, | 60 | |
75 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 1, | 61 | qtest_irq_intercept_in(global_qtest, "/machine/soc/syscfg"); |
76 | .access = PL1_R, .type = ARM_CP_NO_RAW, | 62 | @@ -XXX,XX +XXX,XX @@ static void test_gpio_input_mode(const void *data) |
77 | + .accessfn = access_aa32_tid3, | 63 | * corresponding GPIO line high/low : it should set the |
78 | .readfn = id_pfr1_read, | 64 | * right bit in IDR and send an irq to syscfg. |
79 | .writefn = arm_cp_write_ignore }, | 65 | */ |
80 | { .name = "ID_DFR0", .state = ARM_CP_STATE_BOTH, | 66 | - unsigned int pin = ((uint64_t)data) & 0xF; |
81 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 2, | 67 | - uint32_t gpio = ((uint64_t)data) >> 32; |
82 | .access = PL1_R, .type = ARM_CP_CONST, | 68 | + unsigned int pin = test_pin(data); |
83 | + .accessfn = access_aa32_tid3, | 69 | + uint32_t gpio = test_gpio_addr(data); |
84 | .resetvalue = cpu->id_dfr0 }, | 70 | unsigned int gpio_id = get_gpio_id(gpio); |
85 | { .name = "ID_AFR0", .state = ARM_CP_STATE_BOTH, | 71 | |
86 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 3, | 72 | qtest_irq_intercept_in(global_qtest, "/machine/soc/syscfg"); |
87 | .access = PL1_R, .type = ARM_CP_CONST, | 73 | @@ -XXX,XX +XXX,XX @@ static void test_pull_up_pull_down(const void *data) |
88 | + .accessfn = access_aa32_tid3, | 74 | * Test that a floating pin with pull-up sets the pin |
89 | .resetvalue = cpu->id_afr0 }, | 75 | * high and vice-versa. |
90 | { .name = "ID_MMFR0", .state = ARM_CP_STATE_BOTH, | 76 | */ |
91 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 4, | 77 | - unsigned int pin = ((uint64_t)data) & 0xF; |
92 | .access = PL1_R, .type = ARM_CP_CONST, | 78 | - uint32_t gpio = ((uint64_t)data) >> 32; |
93 | + .accessfn = access_aa32_tid3, | 79 | + unsigned int pin = test_pin(data); |
94 | .resetvalue = cpu->id_mmfr0 }, | 80 | + uint32_t gpio = test_gpio_addr(data); |
95 | { .name = "ID_MMFR1", .state = ARM_CP_STATE_BOTH, | 81 | unsigned int gpio_id = get_gpio_id(gpio); |
96 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 5, | 82 | |
97 | .access = PL1_R, .type = ARM_CP_CONST, | 83 | qtest_irq_intercept_in(global_qtest, "/machine/soc/syscfg"); |
98 | + .accessfn = access_aa32_tid3, | 84 | @@ -XXX,XX +XXX,XX @@ static void test_push_pull(const void *data) |
99 | .resetvalue = cpu->id_mmfr1 }, | 85 | * disconnects the pin, that the pin can't be set or reset |
100 | { .name = "ID_MMFR2", .state = ARM_CP_STATE_BOTH, | 86 | * externally afterwards. |
101 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 6, | 87 | */ |
102 | .access = PL1_R, .type = ARM_CP_CONST, | 88 | - unsigned int pin = ((uint64_t)data) & 0xF; |
103 | + .accessfn = access_aa32_tid3, | 89 | - uint32_t gpio = ((uint64_t)data) >> 32; |
104 | .resetvalue = cpu->id_mmfr2 }, | 90 | + unsigned int pin = test_pin(data); |
105 | { .name = "ID_MMFR3", .state = ARM_CP_STATE_BOTH, | 91 | + uint32_t gpio = test_gpio_addr(data); |
106 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 7, | 92 | uint32_t gpio2 = GPIO_BASE_ADDR + (GPIO_H - gpio); |
107 | .access = PL1_R, .type = ARM_CP_CONST, | 93 | |
108 | + .accessfn = access_aa32_tid3, | 94 | qtest_irq_intercept_in(global_qtest, "/machine/soc/syscfg"); |
109 | .resetvalue = cpu->id_mmfr3 }, | 95 | @@ -XXX,XX +XXX,XX @@ static void test_open_drain(const void *data) |
110 | { .name = "ID_ISAR0", .state = ARM_CP_STATE_BOTH, | 96 | * However a pin set low externally shouldn't be disconnected, |
111 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 0, | 97 | * and it can be set low externally when in open-drain mode. |
112 | .access = PL1_R, .type = ARM_CP_CONST, | 98 | */ |
113 | + .accessfn = access_aa32_tid3, | 99 | - unsigned int pin = ((uint64_t)data) & 0xF; |
114 | .resetvalue = cpu->isar.id_isar0 }, | 100 | - uint32_t gpio = ((uint64_t)data) >> 32; |
115 | { .name = "ID_ISAR1", .state = ARM_CP_STATE_BOTH, | 101 | + unsigned int pin = test_pin(data); |
116 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 1, | 102 | + uint32_t gpio = test_gpio_addr(data); |
117 | .access = PL1_R, .type = ARM_CP_CONST, | 103 | uint32_t gpio2 = GPIO_BASE_ADDR + (GPIO_H - gpio); |
118 | + .accessfn = access_aa32_tid3, | 104 | |
119 | .resetvalue = cpu->isar.id_isar1 }, | 105 | qtest_irq_intercept_in(global_qtest, "/machine/soc/syscfg"); |
120 | { .name = "ID_ISAR2", .state = ARM_CP_STATE_BOTH, | 106 | @@ -XXX,XX +XXX,XX @@ static void test_bsrr_brr(const void *data) |
121 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 2, | 107 | * has the desired effect on ODR. |
122 | .access = PL1_R, .type = ARM_CP_CONST, | 108 | * In BSRR, BSx has priority over BRx. |
123 | + .accessfn = access_aa32_tid3, | 109 | */ |
124 | .resetvalue = cpu->isar.id_isar2 }, | 110 | - unsigned int pin = ((uint64_t)data) & 0xF; |
125 | { .name = "ID_ISAR3", .state = ARM_CP_STATE_BOTH, | 111 | - uint32_t gpio = ((uint64_t)data) >> 32; |
126 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 3, | 112 | + unsigned int pin = test_pin(data); |
127 | .access = PL1_R, .type = ARM_CP_CONST, | 113 | + uint32_t gpio = test_gpio_addr(data); |
128 | + .accessfn = access_aa32_tid3, | 114 | |
129 | .resetvalue = cpu->isar.id_isar3 }, | 115 | gpio_writel(gpio, BSRR, (1 << pin)); |
130 | { .name = "ID_ISAR4", .state = ARM_CP_STATE_BOTH, | 116 | g_assert_cmphex(gpio_readl(gpio, ODR), ==, reset(gpio, ODR) | (1 << pin)); |
131 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 4, | 117 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv) |
132 | .access = PL1_R, .type = ARM_CP_CONST, | 118 | * is problematic since the pin was already high. |
133 | + .accessfn = access_aa32_tid3, | 119 | */ |
134 | .resetvalue = cpu->isar.id_isar4 }, | 120 | qtest_add_data_func("stm32l4x5/gpio/test_gpioc5_output_mode", |
135 | { .name = "ID_ISAR5", .state = ARM_CP_STATE_BOTH, | 121 | - (void *)((uint64_t)GPIO_C << 32 | 5), |
136 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 5, | 122 | + test_data(GPIO_C, 5), |
137 | .access = PL1_R, .type = ARM_CP_CONST, | 123 | test_gpio_output_mode); |
138 | + .accessfn = access_aa32_tid3, | 124 | qtest_add_data_func("stm32l4x5/gpio/test_gpioh3_output_mode", |
139 | .resetvalue = cpu->isar.id_isar5 }, | 125 | - (void *)((uint64_t)GPIO_H << 32 | 3), |
140 | { .name = "ID_MMFR4", .state = ARM_CP_STATE_BOTH, | 126 | + test_data(GPIO_H, 3), |
141 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 6, | 127 | test_gpio_output_mode); |
142 | .access = PL1_R, .type = ARM_CP_CONST, | 128 | qtest_add_data_func("stm32l4x5/gpio/test_gpio_input_mode1", |
143 | + .accessfn = access_aa32_tid3, | 129 | - (void *)((uint64_t)GPIO_D << 32 | 6), |
144 | .resetvalue = cpu->id_mmfr4 }, | 130 | + test_data(GPIO_D, 6), |
145 | { .name = "ID_ISAR6", .state = ARM_CP_STATE_BOTH, | 131 | test_gpio_input_mode); |
146 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 7, | 132 | qtest_add_data_func("stm32l4x5/gpio/test_gpio_input_mode2", |
147 | .access = PL1_R, .type = ARM_CP_CONST, | 133 | - (void *)((uint64_t)GPIO_C << 32 | 10), |
148 | + .accessfn = access_aa32_tid3, | 134 | + test_data(GPIO_C, 10), |
149 | .resetvalue = cpu->isar.id_isar6 }, | 135 | test_gpio_input_mode); |
150 | REGINFO_SENTINEL | 136 | qtest_add_data_func("stm32l4x5/gpio/test_gpio_pull_up_pull_down1", |
151 | }; | 137 | - (void *)((uint64_t)GPIO_B << 32 | 5), |
152 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | 138 | + test_data(GPIO_B, 5), |
153 | { .name = "ID_AA64PFR0_EL1", .state = ARM_CP_STATE_AA64, | 139 | test_pull_up_pull_down); |
154 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 0, | 140 | qtest_add_data_func("stm32l4x5/gpio/test_gpio_pull_up_pull_down2", |
155 | .access = PL1_R, .type = ARM_CP_NO_RAW, | 141 | - (void *)((uint64_t)GPIO_F << 32 | 1), |
156 | + .accessfn = access_aa64_tid3, | 142 | + test_data(GPIO_F, 1), |
157 | .readfn = id_aa64pfr0_read, | 143 | test_pull_up_pull_down); |
158 | .writefn = arm_cp_write_ignore }, | 144 | qtest_add_data_func("stm32l4x5/gpio/test_gpio_push_pull1", |
159 | { .name = "ID_AA64PFR1_EL1", .state = ARM_CP_STATE_AA64, | 145 | - (void *)((uint64_t)GPIO_G << 32 | 6), |
160 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 1, | 146 | + test_data(GPIO_G, 6), |
161 | .access = PL1_R, .type = ARM_CP_CONST, | 147 | test_push_pull); |
162 | + .accessfn = access_aa64_tid3, | 148 | qtest_add_data_func("stm32l4x5/gpio/test_gpio_push_pull2", |
163 | .resetvalue = cpu->isar.id_aa64pfr1}, | 149 | - (void *)((uint64_t)GPIO_H << 32 | 3), |
164 | { .name = "ID_AA64PFR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | 150 | + test_data(GPIO_H, 3), |
165 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 2, | 151 | test_push_pull); |
166 | .access = PL1_R, .type = ARM_CP_CONST, | 152 | qtest_add_data_func("stm32l4x5/gpio/test_gpio_open_drain1", |
167 | + .accessfn = access_aa64_tid3, | 153 | - (void *)((uint64_t)GPIO_C << 32 | 4), |
168 | .resetvalue = 0 }, | 154 | + test_data(GPIO_C, 4), |
169 | { .name = "ID_AA64PFR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | 155 | test_open_drain); |
170 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 3, | 156 | qtest_add_data_func("stm32l4x5/gpio/test_gpio_open_drain2", |
171 | .access = PL1_R, .type = ARM_CP_CONST, | 157 | - (void *)((uint64_t)GPIO_E << 32 | 11), |
172 | + .accessfn = access_aa64_tid3, | 158 | + test_data(GPIO_E, 11), |
173 | .resetvalue = 0 }, | 159 | test_open_drain); |
174 | { .name = "ID_AA64ZFR0_EL1", .state = ARM_CP_STATE_AA64, | 160 | qtest_add_data_func("stm32l4x5/gpio/test_bsrr_brr1", |
175 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 4, | 161 | - (void *)((uint64_t)GPIO_A << 32 | 12), |
176 | .access = PL1_R, .type = ARM_CP_CONST, | 162 | + test_data(GPIO_A, 12), |
177 | + .accessfn = access_aa64_tid3, | 163 | test_bsrr_brr); |
178 | /* At present, only SVEver == 0 is defined anyway. */ | 164 | qtest_add_data_func("stm32l4x5/gpio/test_bsrr_brr2", |
179 | .resetvalue = 0 }, | 165 | - (void *)((uint64_t)GPIO_D << 32 | 0), |
180 | { .name = "ID_AA64PFR5_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | 166 | + test_data(GPIO_D, 0), |
181 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 5, | 167 | test_bsrr_brr); |
182 | .access = PL1_R, .type = ARM_CP_CONST, | 168 | |
183 | + .accessfn = access_aa64_tid3, | 169 | qtest_start("-machine b-l475e-iot01a"); |
184 | .resetvalue = 0 }, | ||
185 | { .name = "ID_AA64PFR6_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
186 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 6, | ||
187 | .access = PL1_R, .type = ARM_CP_CONST, | ||
188 | + .accessfn = access_aa64_tid3, | ||
189 | .resetvalue = 0 }, | ||
190 | { .name = "ID_AA64PFR7_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
191 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 7, | ||
192 | .access = PL1_R, .type = ARM_CP_CONST, | ||
193 | + .accessfn = access_aa64_tid3, | ||
194 | .resetvalue = 0 }, | ||
195 | { .name = "ID_AA64DFR0_EL1", .state = ARM_CP_STATE_AA64, | ||
196 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 0, | ||
197 | .access = PL1_R, .type = ARM_CP_CONST, | ||
198 | + .accessfn = access_aa64_tid3, | ||
199 | .resetvalue = cpu->id_aa64dfr0 }, | ||
200 | { .name = "ID_AA64DFR1_EL1", .state = ARM_CP_STATE_AA64, | ||
201 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 1, | ||
202 | .access = PL1_R, .type = ARM_CP_CONST, | ||
203 | + .accessfn = access_aa64_tid3, | ||
204 | .resetvalue = cpu->id_aa64dfr1 }, | ||
205 | { .name = "ID_AA64DFR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
206 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 2, | ||
207 | .access = PL1_R, .type = ARM_CP_CONST, | ||
208 | + .accessfn = access_aa64_tid3, | ||
209 | .resetvalue = 0 }, | ||
210 | { .name = "ID_AA64DFR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
211 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 3, | ||
212 | .access = PL1_R, .type = ARM_CP_CONST, | ||
213 | + .accessfn = access_aa64_tid3, | ||
214 | .resetvalue = 0 }, | ||
215 | { .name = "ID_AA64AFR0_EL1", .state = ARM_CP_STATE_AA64, | ||
216 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 4, | ||
217 | .access = PL1_R, .type = ARM_CP_CONST, | ||
218 | + .accessfn = access_aa64_tid3, | ||
219 | .resetvalue = cpu->id_aa64afr0 }, | ||
220 | { .name = "ID_AA64AFR1_EL1", .state = ARM_CP_STATE_AA64, | ||
221 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 5, | ||
222 | .access = PL1_R, .type = ARM_CP_CONST, | ||
223 | + .accessfn = access_aa64_tid3, | ||
224 | .resetvalue = cpu->id_aa64afr1 }, | ||
225 | { .name = "ID_AA64AFR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
226 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 6, | ||
227 | .access = PL1_R, .type = ARM_CP_CONST, | ||
228 | + .accessfn = access_aa64_tid3, | ||
229 | .resetvalue = 0 }, | ||
230 | { .name = "ID_AA64AFR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
231 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 7, | ||
232 | .access = PL1_R, .type = ARM_CP_CONST, | ||
233 | + .accessfn = access_aa64_tid3, | ||
234 | .resetvalue = 0 }, | ||
235 | { .name = "ID_AA64ISAR0_EL1", .state = ARM_CP_STATE_AA64, | ||
236 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 0, | ||
237 | .access = PL1_R, .type = ARM_CP_CONST, | ||
238 | + .accessfn = access_aa64_tid3, | ||
239 | .resetvalue = cpu->isar.id_aa64isar0 }, | ||
240 | { .name = "ID_AA64ISAR1_EL1", .state = ARM_CP_STATE_AA64, | ||
241 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 1, | ||
242 | .access = PL1_R, .type = ARM_CP_CONST, | ||
243 | + .accessfn = access_aa64_tid3, | ||
244 | .resetvalue = cpu->isar.id_aa64isar1 }, | ||
245 | { .name = "ID_AA64ISAR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
246 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 2, | ||
247 | .access = PL1_R, .type = ARM_CP_CONST, | ||
248 | + .accessfn = access_aa64_tid3, | ||
249 | .resetvalue = 0 }, | ||
250 | { .name = "ID_AA64ISAR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
251 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 3, | ||
252 | .access = PL1_R, .type = ARM_CP_CONST, | ||
253 | + .accessfn = access_aa64_tid3, | ||
254 | .resetvalue = 0 }, | ||
255 | { .name = "ID_AA64ISAR4_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
256 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 4, | ||
257 | .access = PL1_R, .type = ARM_CP_CONST, | ||
258 | + .accessfn = access_aa64_tid3, | ||
259 | .resetvalue = 0 }, | ||
260 | { .name = "ID_AA64ISAR5_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
261 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 5, | ||
262 | .access = PL1_R, .type = ARM_CP_CONST, | ||
263 | + .accessfn = access_aa64_tid3, | ||
264 | .resetvalue = 0 }, | ||
265 | { .name = "ID_AA64ISAR6_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
266 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 6, | ||
267 | .access = PL1_R, .type = ARM_CP_CONST, | ||
268 | + .accessfn = access_aa64_tid3, | ||
269 | .resetvalue = 0 }, | ||
270 | { .name = "ID_AA64ISAR7_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
271 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 7, | ||
272 | .access = PL1_R, .type = ARM_CP_CONST, | ||
273 | + .accessfn = access_aa64_tid3, | ||
274 | .resetvalue = 0 }, | ||
275 | { .name = "ID_AA64MMFR0_EL1", .state = ARM_CP_STATE_AA64, | ||
276 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 0, | ||
277 | .access = PL1_R, .type = ARM_CP_CONST, | ||
278 | + .accessfn = access_aa64_tid3, | ||
279 | .resetvalue = cpu->isar.id_aa64mmfr0 }, | ||
280 | { .name = "ID_AA64MMFR1_EL1", .state = ARM_CP_STATE_AA64, | ||
281 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 1, | ||
282 | .access = PL1_R, .type = ARM_CP_CONST, | ||
283 | + .accessfn = access_aa64_tid3, | ||
284 | .resetvalue = cpu->isar.id_aa64mmfr1 }, | ||
285 | { .name = "ID_AA64MMFR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
286 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 2, | ||
287 | .access = PL1_R, .type = ARM_CP_CONST, | ||
288 | + .accessfn = access_aa64_tid3, | ||
289 | .resetvalue = 0 }, | ||
290 | { .name = "ID_AA64MMFR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
291 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 3, | ||
292 | .access = PL1_R, .type = ARM_CP_CONST, | ||
293 | + .accessfn = access_aa64_tid3, | ||
294 | .resetvalue = 0 }, | ||
295 | { .name = "ID_AA64MMFR4_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
296 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 4, | ||
297 | .access = PL1_R, .type = ARM_CP_CONST, | ||
298 | + .accessfn = access_aa64_tid3, | ||
299 | .resetvalue = 0 }, | ||
300 | { .name = "ID_AA64MMFR5_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
301 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 5, | ||
302 | .access = PL1_R, .type = ARM_CP_CONST, | ||
303 | + .accessfn = access_aa64_tid3, | ||
304 | .resetvalue = 0 }, | ||
305 | { .name = "ID_AA64MMFR6_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
306 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 6, | ||
307 | .access = PL1_R, .type = ARM_CP_CONST, | ||
308 | + .accessfn = access_aa64_tid3, | ||
309 | .resetvalue = 0 }, | ||
310 | { .name = "ID_AA64MMFR7_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
311 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 7, | ||
312 | .access = PL1_R, .type = ARM_CP_CONST, | ||
313 | + .accessfn = access_aa64_tid3, | ||
314 | .resetvalue = 0 }, | ||
315 | { .name = "MVFR0_EL1", .state = ARM_CP_STATE_AA64, | ||
316 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 0, | ||
317 | .access = PL1_R, .type = ARM_CP_CONST, | ||
318 | + .accessfn = access_aa64_tid3, | ||
319 | .resetvalue = cpu->isar.mvfr0 }, | ||
320 | { .name = "MVFR1_EL1", .state = ARM_CP_STATE_AA64, | ||
321 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 1, | ||
322 | .access = PL1_R, .type = ARM_CP_CONST, | ||
323 | + .accessfn = access_aa64_tid3, | ||
324 | .resetvalue = cpu->isar.mvfr1 }, | ||
325 | { .name = "MVFR2_EL1", .state = ARM_CP_STATE_AA64, | ||
326 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 2, | ||
327 | .access = PL1_R, .type = ARM_CP_CONST, | ||
328 | + .accessfn = access_aa64_tid3, | ||
329 | .resetvalue = cpu->isar.mvfr2 }, | ||
330 | { .name = "MVFR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
331 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 3, | ||
332 | .access = PL1_R, .type = ARM_CP_CONST, | ||
333 | + .accessfn = access_aa64_tid3, | ||
334 | .resetvalue = 0 }, | ||
335 | { .name = "MVFR4_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
336 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 4, | ||
337 | .access = PL1_R, .type = ARM_CP_CONST, | ||
338 | + .accessfn = access_aa64_tid3, | ||
339 | .resetvalue = 0 }, | ||
340 | { .name = "MVFR5_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
341 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 5, | ||
342 | .access = PL1_R, .type = ARM_CP_CONST, | ||
343 | + .accessfn = access_aa64_tid3, | ||
344 | .resetvalue = 0 }, | ||
345 | { .name = "MVFR6_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
346 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 6, | ||
347 | .access = PL1_R, .type = ARM_CP_CONST, | ||
348 | + .accessfn = access_aa64_tid3, | ||
349 | .resetvalue = 0 }, | ||
350 | { .name = "MVFR7_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
351 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 7, | ||
352 | .access = PL1_R, .type = ARM_CP_CONST, | ||
353 | + .accessfn = access_aa64_tid3, | ||
354 | .resetvalue = 0 }, | ||
355 | { .name = "PMCEID0", .state = ARM_CP_STATE_AA32, | ||
356 | .cp = 15, .opc1 = 0, .crn = 9, .crm = 12, .opc2 = 6, | ||
357 | -- | 170 | -- |
358 | 2.20.1 | 171 | 2.34.1 |
359 | 172 | ||
360 | 173 | diff view generated by jsdifflib |
1 | From: Jean-Hugues Deschênes <Jean-Hugues.Deschenes@ossiaco.com> | 1 | From: Cédric Le Goater <clg@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | According to the PushStack() pseudocode in the armv7m RM, | 3 | Change the board revision number and RAM size to 1Gb on 32-bit hosts. |
4 | bit 4 of the LR should be set to NOT(CONTROL.PFCA) when | 4 | On these systems, RAM has a 2047 MB limit and this breaks the tests. |
5 | an FPU is present. Current implementation is doing it for | ||
6 | armv8, but not for armv7. This patch makes the existing | ||
7 | logic applicable to both code paths. | ||
8 | 5 | ||
9 | Signed-off-by: Jean-Hugues Deschenes <jean-hugues.deschenes@ossiaco.com> | 6 | Fixes: 7785e8ea2204 ("hw/arm: Introduce Raspberry PI 4 machine") |
7 | Signed-off-by: Cédric Le Goater <clg@redhat.com> | ||
8 | Message-id: 20240329150155.357043-1-clg@redhat.com | ||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 11 | --- |
13 | target/arm/m_helper.c | 7 +++---- | 12 | hw/arm/raspi4b.c | 4 ++++ |
14 | 1 file changed, 3 insertions(+), 4 deletions(-) | 13 | 1 file changed, 4 insertions(+) |
15 | 14 | ||
16 | diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c | 15 | diff --git a/hw/arm/raspi4b.c b/hw/arm/raspi4b.c |
17 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/m_helper.c | 17 | --- a/hw/arm/raspi4b.c |
19 | +++ b/target/arm/m_helper.c | 18 | +++ b/hw/arm/raspi4b.c |
20 | @@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs) | 19 | @@ -XXX,XX +XXX,XX @@ static void raspi4b_machine_class_init(ObjectClass *oc, void *data) |
21 | if (env->v7m.secure) { | 20 | MachineClass *mc = MACHINE_CLASS(oc); |
22 | lr |= R_V7M_EXCRET_S_MASK; | 21 | RaspiBaseMachineClass *rmc = RASPI_BASE_MACHINE_CLASS(oc); |
23 | } | 22 | |
24 | - if (!(env->v7m.control[M_REG_S] & R_V7M_CONTROL_FPCA_MASK)) { | 23 | +#if HOST_LONG_BITS == 32 |
25 | - lr |= R_V7M_EXCRET_FTYPE_MASK; | 24 | + rmc->board_rev = 0xa03111; /* Revision 1.1, 1 Gb RAM */ |
26 | - } | 25 | +#else |
27 | } else { | 26 | rmc->board_rev = 0xb03115; /* Revision 1.5, 2 Gb RAM */ |
28 | lr = R_V7M_EXCRET_RES1_MASK | | 27 | +#endif |
29 | R_V7M_EXCRET_S_MASK | | 28 | raspi_machine_class_common_init(mc, rmc->board_rev); |
30 | R_V7M_EXCRET_DCRS_MASK | | 29 | mc->init = raspi4b_machine_init; |
31 | - R_V7M_EXCRET_FTYPE_MASK | | 30 | } |
32 | R_V7M_EXCRET_ES_MASK; | ||
33 | if (env->v7m.control[M_REG_NS] & R_V7M_CONTROL_SPSEL_MASK) { | ||
34 | lr |= R_V7M_EXCRET_SPSEL_MASK; | ||
35 | } | ||
36 | } | ||
37 | + if (!(env->v7m.control[M_REG_S] & R_V7M_CONTROL_FPCA_MASK)) { | ||
38 | + lr |= R_V7M_EXCRET_FTYPE_MASK; | ||
39 | + } | ||
40 | if (!arm_v7m_is_handler_mode(env)) { | ||
41 | lr |= R_V7M_EXCRET_MODE_MASK; | ||
42 | } | ||
43 | -- | 31 | -- |
44 | 2.20.1 | 32 | 2.34.1 |
45 | 33 | ||
46 | 34 | diff view generated by jsdifflib |