1 | target-arm queue for rc2. This has 3 Arm related bug fixes, | 1 | Arm patches for rc3 : just a handful of bug fixes. |
---|---|---|---|
2 | and a couple of non-arm patches which don't have an obviously | ||
3 | better route into the tree. | ||
4 | 2 | ||
5 | thanks | 3 | thanks |
6 | -- PMM | 4 | -- PMM |
7 | 5 | ||
8 | The following changes since commit b9e02bb3f98174209dbd5c96858e65a31723221b: | ||
9 | 6 | ||
10 | Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2019-07-19' into staging (2019-07-22 10:11:28 +0100) | 7 | The following changes since commit 4ecc984210ca1bf508a96a550ec8a93a5f833f6c: |
8 | |||
9 | Merge remote-tracking branch 'remotes/palmer/tags/riscv-for-master-4.2-rc3' into staging (2019-11-26 12:36:40 +0000) | ||
11 | 10 | ||
12 | are available in the Git repository at: | 11 | are available in the Git repository at: |
13 | 12 | ||
14 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20190722 | 13 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20191126 |
15 | 14 | ||
16 | for you to fetch changes up to ddb45afbfbc639365d6c934e4e29f6de5e5e2a0e: | 15 | for you to fetch changes up to 6a4ef4e5d1084ce41fafa7d470a644b0fd3d9317: |
17 | 16 | ||
18 | contrib/elf2dmp: Build download.o with CURL_CFLAGS (2019-07-22 14:07:39 +0100) | 17 | target/arm: Honor HCR_EL2.TID3 trapping requirements (2019-11-26 13:55:37 +0000) |
19 | 18 | ||
20 | ---------------------------------------------------------------- | 19 | ---------------------------------------------------------------- |
21 | target-arm queue: | 20 | target-arm queue: |
22 | * target/arm: Add missing break statement for Hypervisor Trap Exception | 21 | * handle FTYPE flag correctly in v7M exception return |
23 | (fixes handling of SMC insn taken to AArch32 Hyp mode via HCR.TSC) | 22 | for v7M CPUs with an FPU (v8M CPUs were already correct) |
24 | * hw/arm/fsl-imx6ul.c: Remove dead SMP-related code | 23 | * versal: Add the CRP as unimplemented |
25 | * target/arm: Limit ID register assertions to TCG | 24 | * Fix ISR_EL1 tracking when executing at EL2 |
26 | * configure: Clarify URL to source downloads | 25 | * Honor HCR_EL2.TID3 trapping requirements |
27 | * contrib/elf2dmp: Build download.o with CURL_CFLAGS | ||
28 | 26 | ||
29 | ---------------------------------------------------------------- | 27 | ---------------------------------------------------------------- |
30 | Peter Maydell (4): | 28 | Edgar E. Iglesias (1): |
31 | hw/arm/fsl-imx6ul.c: Remove dead SMP-related code | 29 | hw/arm: versal: Add the CRP as unimplemented |
32 | target/arm: Limit ID register assertions to TCG | ||
33 | configure: Clarify URL to source downloads | ||
34 | contrib/elf2dmp: Build download.o with CURL_CFLAGS | ||
35 | 30 | ||
36 | Philippe Mathieu-Daudé (1): | 31 | Jean-Hugues Deschênes (1): |
37 | target/arm: Add missing break statement for Hypervisor Trap Exception | 32 | target/arm: Fix handling of cortex-m FTYPE flag in EXCRET |
38 | 33 | ||
39 | configure | 2 +- | 34 | Marc Zyngier (2): |
40 | Makefile | 1 - | 35 | target/arm: Fix ISR_EL1 tracking when executing at EL2 |
41 | contrib/elf2dmp/Makefile.objs | 3 +++ | 36 | target/arm: Honor HCR_EL2.TID3 trapping requirements |
42 | include/hw/arm/fsl-imx6ul.h | 2 +- | ||
43 | hw/arm/fsl-imx6ul.c | 62 +++++++++++++------------------------------ | ||
44 | hw/arm/mcimx6ul-evk.c | 2 +- | ||
45 | target/arm/cpu.c | 7 +++-- | ||
46 | target/arm/helper.c | 1 + | ||
47 | 8 files changed, 30 insertions(+), 50 deletions(-) | ||
48 | 37 | ||
38 | include/hw/arm/xlnx-versal.h | 3 ++ | ||
39 | hw/arm/xlnx-versal.c | 2 ++ | ||
40 | target/arm/helper.c | 83 ++++++++++++++++++++++++++++++++++++++++++-- | ||
41 | target/arm/m_helper.c | 7 ++-- | ||
42 | 4 files changed, 89 insertions(+), 6 deletions(-) | ||
43 | diff view generated by jsdifflib |
1 | contrib/elf2dmp has a source file which uses curl/curl.h; | 1 | From: Jean-Hugues Deschênes <Jean-Hugues.Deschenes@ossiaco.com> |
---|---|---|---|
2 | although we link the final executable with CURL_LIBS, we | ||
3 | forgot to build this source file with CURL_CFLAGS, so if | ||
4 | the curl header is in a place that's not already on the | ||
5 | system include path then it will fail to build. | ||
6 | 2 | ||
7 | Add a line specifying the cflags needed for download.o; | 3 | According to the PushStack() pseudocode in the armv7m RM, |
8 | while we are here, bring the specification of the libs | 4 | bit 4 of the LR should be set to NOT(CONTROL.PFCA) when |
9 | into line with this, since using a per-object variable | 5 | an FPU is present. Current implementation is doing it for |
10 | setting is preferred over adding them to the final | 6 | armv8, but not for armv7. This patch makes the existing |
11 | executable link line. | 7 | logic applicable to both code paths. |
12 | 8 | ||
9 | Signed-off-by: Jean-Hugues Deschenes <jean-hugues.deschenes@ossiaco.com> | ||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> | ||
15 | Message-id: 20190719100955.17180-1-peter.maydell@linaro.org | ||
16 | --- | 12 | --- |
17 | Makefile | 1 - | 13 | target/arm/m_helper.c | 7 +++---- |
18 | contrib/elf2dmp/Makefile.objs | 3 +++ | 14 | 1 file changed, 3 insertions(+), 4 deletions(-) |
19 | 2 files changed, 3 insertions(+), 1 deletion(-) | ||
20 | 15 | ||
21 | diff --git a/Makefile b/Makefile | 16 | diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c |
22 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/Makefile | 18 | --- a/target/arm/m_helper.c |
24 | +++ b/Makefile | 19 | +++ b/target/arm/m_helper.c |
25 | @@ -XXX,XX +XXX,XX @@ ifneq ($(EXESUF),) | 20 | @@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs) |
26 | qemu-ga: qemu-ga$(EXESUF) $(QGA_VSS_PROVIDER) $(QEMU_GA_MSI) | 21 | if (env->v7m.secure) { |
27 | endif | 22 | lr |= R_V7M_EXCRET_S_MASK; |
28 | 23 | } | |
29 | -elf2dmp$(EXESUF): LIBS += $(CURL_LIBS) | 24 | - if (!(env->v7m.control[M_REG_S] & R_V7M_CONTROL_FPCA_MASK)) { |
30 | elf2dmp$(EXESUF): $(elf2dmp-obj-y) | 25 | - lr |= R_V7M_EXCRET_FTYPE_MASK; |
31 | $(call LINK, $^) | 26 | - } |
32 | 27 | } else { | |
33 | diff --git a/contrib/elf2dmp/Makefile.objs b/contrib/elf2dmp/Makefile.objs | 28 | lr = R_V7M_EXCRET_RES1_MASK | |
34 | index XXXXXXX..XXXXXXX 100644 | 29 | R_V7M_EXCRET_S_MASK | |
35 | --- a/contrib/elf2dmp/Makefile.objs | 30 | R_V7M_EXCRET_DCRS_MASK | |
36 | +++ b/contrib/elf2dmp/Makefile.objs | 31 | - R_V7M_EXCRET_FTYPE_MASK | |
37 | @@ -1 +1,4 @@ | 32 | R_V7M_EXCRET_ES_MASK; |
38 | elf2dmp-obj-y = main.o addrspace.o download.o pdb.o qemu_elf.o | 33 | if (env->v7m.control[M_REG_NS] & R_V7M_CONTROL_SPSEL_MASK) { |
39 | + | 34 | lr |= R_V7M_EXCRET_SPSEL_MASK; |
40 | +download.o-cflags := $(CURL_CFLAGS) | 35 | } |
41 | +download.o-libs := $(CURL_LIBS) | 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 | } | ||
42 | -- | 43 | -- |
43 | 2.20.1 | 44 | 2.20.1 |
44 | 45 | ||
45 | 46 | diff view generated by jsdifflib |
1 | If configure detects that it's being run on a source tree which | 1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> |
---|---|---|---|
2 | is missing git modules, it prints an error messages suggesting | ||
3 | that the user downloads a correct source archive from the project | ||
4 | website. However https://www.qemu.org/download/ is a link to a | ||
5 | page with multiple tabs, with the default being the one telling | ||
6 | users how to get binaries from their distro. Clarify the URL | ||
7 | we print to include the #source anchor, so that the browser will | ||
8 | go directly to the source-tarball instructions. | ||
9 | 2 | ||
10 | Reported-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 3 | Add the CRP as unimplemented thus avoiding bus errors when |
11 | Reviewed-by: Thomas Huth <thuth@redhat.com> | 4 | guests access these registers. |
12 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 5 | |
13 | Reviewed-by: Stefan Weil <sw@weilnetz.de> | 6 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> |
14 | Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> |
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> |
16 | Message-id: 20190718131659.20783-1-peter.maydell@linaro.org | 9 | Message-id: 20191115154734.26449-2-edgar.iglesias@gmail.com |
17 | Suggested-by: Stefan Weil <sw@weilnetz.de> | ||
18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
19 | --- | 11 | --- |
20 | configure | 2 +- | 12 | include/hw/arm/xlnx-versal.h | 3 +++ |
21 | 1 file changed, 1 insertion(+), 1 deletion(-) | 13 | hw/arm/xlnx-versal.c | 2 ++ |
14 | 2 files changed, 5 insertions(+) | ||
22 | 15 | ||
23 | diff --git a/configure b/configure | 16 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h |
24 | index XXXXXXX..XXXXXXX 100755 | 17 | index XXXXXXX..XXXXXXX 100644 |
25 | --- a/configure | 18 | --- a/include/hw/arm/xlnx-versal.h |
26 | +++ b/configure | 19 | +++ b/include/hw/arm/xlnx-versal.h |
27 | @@ -XXX,XX +XXX,XX @@ else | 20 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { |
28 | echo "to acquire QEMU source archives. Non-GIT builds are only" | 21 | #define MM_IOU_SCNTRS_SIZE 0x10000 |
29 | echo "supported with source archives linked from:" | 22 | #define MM_FPD_CRF 0xfd1a0000U |
30 | echo | 23 | #define MM_FPD_CRF_SIZE 0x140000 |
31 | - echo " https://www.qemu.org/download/" | 24 | + |
32 | + echo " https://www.qemu.org/download/#source" | 25 | +#define MM_PMC_CRP 0xf1260000U |
33 | echo | 26 | +#define MM_PMC_CRP_SIZE 0x10000 |
34 | echo "Developers working with GIT can use scripts/archive-source.sh" | 27 | #endif |
35 | echo "if they need to create valid source archives." | 28 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c |
29 | index XXXXXXX..XXXXXXX 100644 | ||
30 | --- a/hw/arm/xlnx-versal.c | ||
31 | +++ b/hw/arm/xlnx-versal.c | ||
32 | @@ -XXX,XX +XXX,XX @@ static void versal_unimp(Versal *s) | ||
33 | MM_CRL, MM_CRL_SIZE); | ||
34 | versal_unimp_area(s, "crf", &s->mr_ps, | ||
35 | MM_FPD_CRF, MM_FPD_CRF_SIZE); | ||
36 | + versal_unimp_area(s, "crp", &s->mr_ps, | ||
37 | + MM_PMC_CRP, MM_PMC_CRP_SIZE); | ||
38 | versal_unimp_area(s, "iou-scntr", &s->mr_ps, | ||
39 | MM_IOU_SCNTR, MM_IOU_SCNTR_SIZE); | ||
40 | versal_unimp_area(s, "iou-scntr-seucre", &s->mr_ps, | ||
36 | -- | 41 | -- |
37 | 2.20.1 | 42 | 2.20.1 |
38 | 43 | ||
39 | 44 | diff view generated by jsdifflib |
1 | In arm_cpu_realizefn() we make several assertions about the values of | 1 | From: Marc Zyngier <maz@kernel.org> |
---|---|---|---|
2 | guest ID registers: | ||
3 | * if the CPU provides AArch32 v7VE or better it must advertise the | ||
4 | ARM_DIV feature | ||
5 | * if the CPU provides AArch32 A-profile v6 or better it must | ||
6 | advertise the Jazelle feature | ||
7 | 2 | ||
8 | These are essentially consistency checks that our ID register | 3 | The ARMv8 ARM states when executing at EL2, EL3 or Secure EL1, |
9 | specifications in cpu.c didn't accidentally miss out a feature, | 4 | ISR_EL1 shows the pending status of the physical IRQ, FIQ, or |
10 | because increasingly the TCG emulation gates features on the values | 5 | SError interrupts. |
11 | in ID registers rather than using old-style checks of ARM_FEATURE_FOO | ||
12 | bits. | ||
13 | 6 | ||
14 | Unfortunately, these asserts can cause problems if we're running KVM, | 7 | Unfortunately, QEMU's implementation only considers the HCR_EL2 |
15 | because in that case we don't control the values of the ID registers | 8 | bits, and ignores the current exception level. This means a hypervisor |
16 | -- we read them from the host kernel. In particular, if the host | 9 | trying to look at its own interrupt state actually sees the guest |
17 | kernel is older than 4.15 then it doesn't expose the ID registers via | 10 | state, which is unexpected and breaks KVM as of Linux 5.3. |
18 | the KVM_GET_ONE_REG ioctl, and we set up dummy values for some | ||
19 | registers and leave the rest at zero. (See the comment in | ||
20 | target/arm/kvm64.c kvm_arm_get_host_cpu_features().) This set of | ||
21 | dummy values is not sufficient to pass our assertions, and so on | ||
22 | those kernels running an AArch32 guest on AArch64 will assert. | ||
23 | 11 | ||
24 | We could provide a more sophisticated set of dummy ID registers in | 12 | Instead, check for the running EL and return the physical bits |
25 | this case, but that still leaves the possibility of a host CPU which | 13 | if not running in a virtualized context. |
26 | reports bogus ID register values that would cause us to assert. It's | ||
27 | more robust to only do these ID register checks if we're using TCG, | ||
28 | as that is the only case where this is truly a QEMU code bug. | ||
29 | 14 | ||
30 | Reported-by: Laszlo Ersek <lersek@redhat.com> | 15 | Fixes: 636540e9c40b |
31 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 16 | Cc: qemu-stable@nongnu.org |
32 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 17 | Reported-by: Quentin Perret <qperret@google.com> |
33 | Tested-by: Laszlo Ersek <lersek@redhat.com> | 18 | Signed-off-by: Marc Zyngier <maz@kernel.org> |
34 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 19 | Message-id: 20191122135833.28953-1-maz@kernel.org |
35 | Message-id: 20190718125928.20147-1-peter.maydell@linaro.org | 20 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
36 | Fixes: https://bugs.launchpad.net/qemu/+bug/1830864 | 21 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> |
37 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 22 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
38 | --- | 23 | --- |
39 | target/arm/cpu.c | 7 +++++-- | 24 | target/arm/helper.c | 7 +++++-- |
40 | 1 file changed, 5 insertions(+), 2 deletions(-) | 25 | 1 file changed, 5 insertions(+), 2 deletions(-) |
41 | 26 | ||
42 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | 27 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
43 | index XXXXXXX..XXXXXXX 100644 | 28 | index XXXXXXX..XXXXXXX 100644 |
44 | --- a/target/arm/cpu.c | 29 | --- a/target/arm/helper.c |
45 | +++ b/target/arm/cpu.c | 30 | +++ b/target/arm/helper.c |
46 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) | 31 | @@ -XXX,XX +XXX,XX @@ static uint64_t isr_read(CPUARMState *env, const ARMCPRegInfo *ri) |
47 | * There exist AArch64 cpus without AArch32 support. When KVM | 32 | CPUState *cs = env_cpu(env); |
48 | * queries ID_ISAR0_EL1 on such a host, the value is UNKNOWN. | 33 | uint64_t hcr_el2 = arm_hcr_el2_eff(env); |
49 | * Similarly, we cannot check ID_AA64PFR0 without AArch64 support. | 34 | uint64_t ret = 0; |
50 | + * As a general principle, we also do not make ID register | 35 | + bool allow_virt = (arm_current_el(env) == 1 && |
51 | + * consistency checks anywhere unless using TCG, because only | 36 | + (!arm_is_secure_below_el3(env) || |
52 | + * for TCG would a consistency-check failure be a QEMU bug. | 37 | + (env->cp15.scr_el3 & SCR_EEL2))); |
53 | */ | 38 | |
54 | if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) { | 39 | - if (hcr_el2 & HCR_IMO) { |
55 | no_aa32 = !cpu_isar_feature(aa64_aa32, cpu); | 40 | + if (allow_virt && (hcr_el2 & HCR_IMO)) { |
56 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) | 41 | if (cs->interrupt_request & CPU_INTERRUPT_VIRQ) { |
57 | * Presence of EL2 itself is ARM_FEATURE_EL2, and of the | 42 | ret |= CPSR_I; |
58 | * Security Extensions is ARM_FEATURE_EL3. | 43 | } |
59 | */ | 44 | @@ -XXX,XX +XXX,XX @@ static uint64_t isr_read(CPUARMState *env, const ARMCPRegInfo *ri) |
60 | - assert(no_aa32 || cpu_isar_feature(arm_div, cpu)); | ||
61 | + assert(!tcg_enabled() || no_aa32 || cpu_isar_feature(arm_div, cpu)); | ||
62 | set_feature(env, ARM_FEATURE_LPAE); | ||
63 | set_feature(env, ARM_FEATURE_V7); | ||
64 | } | ||
65 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) | ||
66 | if (arm_feature(env, ARM_FEATURE_V6)) { | ||
67 | set_feature(env, ARM_FEATURE_V5); | ||
68 | if (!arm_feature(env, ARM_FEATURE_M)) { | ||
69 | - assert(no_aa32 || cpu_isar_feature(jazelle, cpu)); | ||
70 | + assert(!tcg_enabled() || no_aa32 || cpu_isar_feature(jazelle, cpu)); | ||
71 | set_feature(env, ARM_FEATURE_AUXCR); | ||
72 | } | 45 | } |
73 | } | 46 | } |
47 | |||
48 | - if (hcr_el2 & HCR_FMO) { | ||
49 | + if (allow_virt && (hcr_el2 & HCR_FMO)) { | ||
50 | if (cs->interrupt_request & CPU_INTERRUPT_VFIQ) { | ||
51 | ret |= CPSR_F; | ||
52 | } | ||
74 | -- | 53 | -- |
75 | 2.20.1 | 54 | 2.20.1 |
76 | 55 | ||
77 | 56 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Marc Zyngier <maz@kernel.org> |
---|---|---|---|
2 | 2 | ||
3 | Reported by GCC9 when building with -Wimplicit-fallthrough=2: | 3 | HCR_EL2.TID3 mandates that access from EL1 to a long list of id |
4 | 4 | registers traps to EL2, and QEMU has so far ignored this requirement. | |
5 | target/arm/helper.c: In function ‘arm_cpu_do_interrupt_aarch32_hyp’: | 5 | |
6 | target/arm/helper.c:7958:14: error: this statement may fall through [-Werror=implicit-fallthrough=] | 6 | This breaks (among other things) KVM guests that have PtrAuth enabled, |
7 | 7958 | addr = 0x14; | 7 | while the hypervisor doesn't want to expose the feature to its guest. |
8 | | ~~~~~^~~~~~ | 8 | To achieve this, KVM traps the ID registers (ID_AA64ISAR1_EL1 in this |
9 | target/arm/helper.c:7959:5: note: here | 9 | case), and masks out the unsupported feature. |
10 | 7959 | default: | 10 | |
11 | | ^~~~~~~ | 11 | QEMU not honoring the trap request means that the guest observes |
12 | cc1: all warnings being treated as errors | 12 | that the feature is present in the HW, starts using it, and dies |
13 | 13 | a horrible death when KVM injects an UNDEF, because the feature | |
14 | Fixes: b9bc21ff9f9 | 14 | *really* isn't supported. |
15 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 15 | |
16 | Reported-by: Stefan Weil <sw@weilnetz.de> | 16 | Do the right thing by trapping to EL2 if HCR_EL2.TID3 is set. |
17 | |||
18 | Note that this change does not include trapping of the MVFR | ||
19 | registers from AArch32 (they are accessed via the VMRS | ||
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] | ||
17 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 28 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
18 | Message-id: 20190719111451.12406-1-philmd@redhat.com | ||
19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 29 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
20 | --- | 30 | --- |
21 | target/arm/helper.c | 1 + | 31 | target/arm/helper.c | 76 +++++++++++++++++++++++++++++++++++++++++++++ |
22 | 1 file changed, 1 insertion(+) | 32 | 1 file changed, 76 insertions(+) |
23 | 33 | ||
24 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 34 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
25 | index XXXXXXX..XXXXXXX 100644 | 35 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/target/arm/helper.c | 36 | --- a/target/arm/helper.c |
27 | +++ b/target/arm/helper.c | 37 | +++ b/target/arm/helper.c |
28 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_do_interrupt_aarch32_hyp(CPUState *cs) | 38 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo predinv_reginfo[] = { |
29 | break; | 39 | REGINFO_SENTINEL |
30 | case EXCP_HYP_TRAP: | 40 | }; |
31 | addr = 0x14; | 41 | |
32 | + break; | 42 | +static CPAccessResult access_aa64_tid3(CPUARMState *env, const ARMCPRegInfo *ri, |
33 | default: | 43 | + bool isread) |
34 | cpu_abort(cs, "Unhandled exception 0x%x\n", cs->exception_index); | 44 | +{ |
35 | } | 45 | + if ((arm_current_el(env) < 2) && (arm_hcr_el2_eff(env) & HCR_TID3)) { |
46 | + return CP_ACCESS_TRAP_EL2; | ||
47 | + } | ||
48 | + | ||
49 | + return CP_ACCESS_OK; | ||
50 | +} | ||
51 | + | ||
52 | +static CPAccessResult access_aa32_tid3(CPUARMState *env, const ARMCPRegInfo *ri, | ||
53 | + bool isread) | ||
54 | +{ | ||
55 | + if (arm_feature(env, ARM_FEATURE_V8)) { | ||
56 | + return access_aa64_tid3(env, ri, isread); | ||
57 | + } | ||
58 | + | ||
59 | + return CP_ACCESS_OK; | ||
60 | +} | ||
61 | + | ||
62 | void register_cp_regs_for_features(ARMCPU *cpu) | ||
63 | { | ||
64 | /* Register all the coprocessor registers based on feature bits */ | ||
65 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
66 | { .name = "ID_PFR0", .state = ARM_CP_STATE_BOTH, | ||
67 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 0, | ||
68 | .access = PL1_R, .type = ARM_CP_CONST, | ||
69 | + .accessfn = access_aa32_tid3, | ||
70 | .resetvalue = cpu->id_pfr0 }, | ||
71 | /* ID_PFR1 is not a plain ARM_CP_CONST because we don't know | ||
72 | * the value of the GIC field until after we define these regs. | ||
73 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
74 | { .name = "ID_PFR1", .state = ARM_CP_STATE_BOTH, | ||
75 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 1, | ||
76 | .access = PL1_R, .type = ARM_CP_NO_RAW, | ||
77 | + .accessfn = access_aa32_tid3, | ||
78 | .readfn = id_pfr1_read, | ||
79 | .writefn = arm_cp_write_ignore }, | ||
80 | { .name = "ID_DFR0", .state = ARM_CP_STATE_BOTH, | ||
81 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 2, | ||
82 | .access = PL1_R, .type = ARM_CP_CONST, | ||
83 | + .accessfn = access_aa32_tid3, | ||
84 | .resetvalue = cpu->id_dfr0 }, | ||
85 | { .name = "ID_AFR0", .state = ARM_CP_STATE_BOTH, | ||
86 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 3, | ||
87 | .access = PL1_R, .type = ARM_CP_CONST, | ||
88 | + .accessfn = access_aa32_tid3, | ||
89 | .resetvalue = cpu->id_afr0 }, | ||
90 | { .name = "ID_MMFR0", .state = ARM_CP_STATE_BOTH, | ||
91 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 4, | ||
92 | .access = PL1_R, .type = ARM_CP_CONST, | ||
93 | + .accessfn = access_aa32_tid3, | ||
94 | .resetvalue = cpu->id_mmfr0 }, | ||
95 | { .name = "ID_MMFR1", .state = ARM_CP_STATE_BOTH, | ||
96 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 5, | ||
97 | .access = PL1_R, .type = ARM_CP_CONST, | ||
98 | + .accessfn = access_aa32_tid3, | ||
99 | .resetvalue = cpu->id_mmfr1 }, | ||
100 | { .name = "ID_MMFR2", .state = ARM_CP_STATE_BOTH, | ||
101 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 6, | ||
102 | .access = PL1_R, .type = ARM_CP_CONST, | ||
103 | + .accessfn = access_aa32_tid3, | ||
104 | .resetvalue = cpu->id_mmfr2 }, | ||
105 | { .name = "ID_MMFR3", .state = ARM_CP_STATE_BOTH, | ||
106 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 7, | ||
107 | .access = PL1_R, .type = ARM_CP_CONST, | ||
108 | + .accessfn = access_aa32_tid3, | ||
109 | .resetvalue = cpu->id_mmfr3 }, | ||
110 | { .name = "ID_ISAR0", .state = ARM_CP_STATE_BOTH, | ||
111 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 0, | ||
112 | .access = PL1_R, .type = ARM_CP_CONST, | ||
113 | + .accessfn = access_aa32_tid3, | ||
114 | .resetvalue = cpu->isar.id_isar0 }, | ||
115 | { .name = "ID_ISAR1", .state = ARM_CP_STATE_BOTH, | ||
116 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 1, | ||
117 | .access = PL1_R, .type = ARM_CP_CONST, | ||
118 | + .accessfn = access_aa32_tid3, | ||
119 | .resetvalue = cpu->isar.id_isar1 }, | ||
120 | { .name = "ID_ISAR2", .state = ARM_CP_STATE_BOTH, | ||
121 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 2, | ||
122 | .access = PL1_R, .type = ARM_CP_CONST, | ||
123 | + .accessfn = access_aa32_tid3, | ||
124 | .resetvalue = cpu->isar.id_isar2 }, | ||
125 | { .name = "ID_ISAR3", .state = ARM_CP_STATE_BOTH, | ||
126 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 3, | ||
127 | .access = PL1_R, .type = ARM_CP_CONST, | ||
128 | + .accessfn = access_aa32_tid3, | ||
129 | .resetvalue = cpu->isar.id_isar3 }, | ||
130 | { .name = "ID_ISAR4", .state = ARM_CP_STATE_BOTH, | ||
131 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 4, | ||
132 | .access = PL1_R, .type = ARM_CP_CONST, | ||
133 | + .accessfn = access_aa32_tid3, | ||
134 | .resetvalue = cpu->isar.id_isar4 }, | ||
135 | { .name = "ID_ISAR5", .state = ARM_CP_STATE_BOTH, | ||
136 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 5, | ||
137 | .access = PL1_R, .type = ARM_CP_CONST, | ||
138 | + .accessfn = access_aa32_tid3, | ||
139 | .resetvalue = cpu->isar.id_isar5 }, | ||
140 | { .name = "ID_MMFR4", .state = ARM_CP_STATE_BOTH, | ||
141 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 6, | ||
142 | .access = PL1_R, .type = ARM_CP_CONST, | ||
143 | + .accessfn = access_aa32_tid3, | ||
144 | .resetvalue = cpu->id_mmfr4 }, | ||
145 | { .name = "ID_ISAR6", .state = ARM_CP_STATE_BOTH, | ||
146 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 7, | ||
147 | .access = PL1_R, .type = ARM_CP_CONST, | ||
148 | + .accessfn = access_aa32_tid3, | ||
149 | .resetvalue = cpu->isar.id_isar6 }, | ||
150 | REGINFO_SENTINEL | ||
151 | }; | ||
152 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
153 | { .name = "ID_AA64PFR0_EL1", .state = ARM_CP_STATE_AA64, | ||
154 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 0, | ||
155 | .access = PL1_R, .type = ARM_CP_NO_RAW, | ||
156 | + .accessfn = access_aa64_tid3, | ||
157 | .readfn = id_aa64pfr0_read, | ||
158 | .writefn = arm_cp_write_ignore }, | ||
159 | { .name = "ID_AA64PFR1_EL1", .state = ARM_CP_STATE_AA64, | ||
160 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 1, | ||
161 | .access = PL1_R, .type = ARM_CP_CONST, | ||
162 | + .accessfn = access_aa64_tid3, | ||
163 | .resetvalue = cpu->isar.id_aa64pfr1}, | ||
164 | { .name = "ID_AA64PFR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
165 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 2, | ||
166 | .access = PL1_R, .type = ARM_CP_CONST, | ||
167 | + .accessfn = access_aa64_tid3, | ||
168 | .resetvalue = 0 }, | ||
169 | { .name = "ID_AA64PFR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
170 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 3, | ||
171 | .access = PL1_R, .type = ARM_CP_CONST, | ||
172 | + .accessfn = access_aa64_tid3, | ||
173 | .resetvalue = 0 }, | ||
174 | { .name = "ID_AA64ZFR0_EL1", .state = ARM_CP_STATE_AA64, | ||
175 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 4, | ||
176 | .access = PL1_R, .type = ARM_CP_CONST, | ||
177 | + .accessfn = access_aa64_tid3, | ||
178 | /* At present, only SVEver == 0 is defined anyway. */ | ||
179 | .resetvalue = 0 }, | ||
180 | { .name = "ID_AA64PFR5_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
181 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 5, | ||
182 | .access = PL1_R, .type = ARM_CP_CONST, | ||
183 | + .accessfn = access_aa64_tid3, | ||
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, | ||
36 | -- | 357 | -- |
37 | 2.20.1 | 358 | 2.20.1 |
38 | 359 | ||
39 | 360 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | The i.MX6UL always has a single Cortex-A7 CPU (we set FSL_IMX6UL_NUM_CPUS | ||
2 | to 1 in line with this). This means that all the code in fsl-imx6ul.c to | ||
3 | handle multiple CPUs is dead code, and Coverity is now complaining that | ||
4 | it is unreachable (CID 1403008, 1403011). | ||
5 | 1 | ||
6 | Remove the unreachable code and the only-executes-once loops, | ||
7 | and replace the single-entry cpu[] array in the FSLIMX6ULState | ||
8 | with a simple cpu member. | ||
9 | |||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
12 | Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
13 | Message-id: 20190712115030.26895-1-peter.maydell@linaro.org | ||
14 | --- | ||
15 | include/hw/arm/fsl-imx6ul.h | 2 +- | ||
16 | hw/arm/fsl-imx6ul.c | 62 +++++++++++-------------------------- | ||
17 | hw/arm/mcimx6ul-evk.c | 2 +- | ||
18 | 3 files changed, 20 insertions(+), 46 deletions(-) | ||
19 | |||
20 | diff --git a/include/hw/arm/fsl-imx6ul.h b/include/hw/arm/fsl-imx6ul.h | ||
21 | index XXXXXXX..XXXXXXX 100644 | ||
22 | --- a/include/hw/arm/fsl-imx6ul.h | ||
23 | +++ b/include/hw/arm/fsl-imx6ul.h | ||
24 | @@ -XXX,XX +XXX,XX @@ typedef struct FslIMX6ULState { | ||
25 | DeviceState parent_obj; | ||
26 | |||
27 | /*< public >*/ | ||
28 | - ARMCPU cpu[FSL_IMX6UL_NUM_CPUS]; | ||
29 | + ARMCPU cpu; | ||
30 | A15MPPrivState a7mpcore; | ||
31 | IMXGPTState gpt[FSL_IMX6UL_NUM_GPTS]; | ||
32 | IMXEPITState epit[FSL_IMX6UL_NUM_EPITS]; | ||
33 | diff --git a/hw/arm/fsl-imx6ul.c b/hw/arm/fsl-imx6ul.c | ||
34 | index XXXXXXX..XXXXXXX 100644 | ||
35 | --- a/hw/arm/fsl-imx6ul.c | ||
36 | +++ b/hw/arm/fsl-imx6ul.c | ||
37 | @@ -XXX,XX +XXX,XX @@ | ||
38 | |||
39 | static void fsl_imx6ul_init(Object *obj) | ||
40 | { | ||
41 | - MachineState *ms = MACHINE(qdev_get_machine()); | ||
42 | FslIMX6ULState *s = FSL_IMX6UL(obj); | ||
43 | char name[NAME_SIZE]; | ||
44 | int i; | ||
45 | |||
46 | - for (i = 0; i < MIN(ms->smp.cpus, FSL_IMX6UL_NUM_CPUS); i++) { | ||
47 | - snprintf(name, NAME_SIZE, "cpu%d", i); | ||
48 | - object_initialize_child(obj, name, &s->cpu[i], sizeof(s->cpu[i]), | ||
49 | - "cortex-a7-" TYPE_ARM_CPU, &error_abort, NULL); | ||
50 | - } | ||
51 | + object_initialize_child(obj, "cpu0", &s->cpu, sizeof(s->cpu), | ||
52 | + "cortex-a7-" TYPE_ARM_CPU, &error_abort, NULL); | ||
53 | |||
54 | /* | ||
55 | * A7MPCORE | ||
56 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) | ||
57 | MachineState *ms = MACHINE(qdev_get_machine()); | ||
58 | FslIMX6ULState *s = FSL_IMX6UL(dev); | ||
59 | int i; | ||
60 | - qemu_irq irq; | ||
61 | char name[NAME_SIZE]; | ||
62 | - unsigned int smp_cpus = ms->smp.cpus; | ||
63 | + SysBusDevice *sbd; | ||
64 | + DeviceState *d; | ||
65 | |||
66 | - if (smp_cpus > FSL_IMX6UL_NUM_CPUS) { | ||
67 | - error_setg(errp, "%s: Only %d CPUs are supported (%d requested)", | ||
68 | - TYPE_FSL_IMX6UL, FSL_IMX6UL_NUM_CPUS, smp_cpus); | ||
69 | + if (ms->smp.cpus > 1) { | ||
70 | + error_setg(errp, "%s: Only a single CPU is supported (%d requested)", | ||
71 | + TYPE_FSL_IMX6UL, ms->smp.cpus); | ||
72 | return; | ||
73 | } | ||
74 | |||
75 | - for (i = 0; i < smp_cpus; i++) { | ||
76 | - Object *o = OBJECT(&s->cpu[i]); | ||
77 | - | ||
78 | - object_property_set_int(o, QEMU_PSCI_CONDUIT_SMC, | ||
79 | - "psci-conduit", &error_abort); | ||
80 | - | ||
81 | - /* On uniprocessor, the CBAR is set to 0 */ | ||
82 | - if (smp_cpus > 1) { | ||
83 | - object_property_set_int(o, FSL_IMX6UL_A7MPCORE_ADDR, | ||
84 | - "reset-cbar", &error_abort); | ||
85 | - } | ||
86 | - | ||
87 | - if (i) { | ||
88 | - /* Secondary CPUs start in PSCI powered-down state */ | ||
89 | - object_property_set_bool(o, true, | ||
90 | - "start-powered-off", &error_abort); | ||
91 | - } | ||
92 | - | ||
93 | - object_property_set_bool(o, true, "realized", &error_abort); | ||
94 | - } | ||
95 | + object_property_set_int(OBJECT(&s->cpu), QEMU_PSCI_CONDUIT_SMC, | ||
96 | + "psci-conduit", &error_abort); | ||
97 | + object_property_set_bool(OBJECT(&s->cpu), true, | ||
98 | + "realized", &error_abort); | ||
99 | |||
100 | /* | ||
101 | * A7MPCORE | ||
102 | */ | ||
103 | - object_property_set_int(OBJECT(&s->a7mpcore), smp_cpus, "num-cpu", | ||
104 | - &error_abort); | ||
105 | + object_property_set_int(OBJECT(&s->a7mpcore), 1, "num-cpu", &error_abort); | ||
106 | object_property_set_int(OBJECT(&s->a7mpcore), | ||
107 | FSL_IMX6UL_MAX_IRQ + GIC_INTERNAL, | ||
108 | "num-irq", &error_abort); | ||
109 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) | ||
110 | &error_abort); | ||
111 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->a7mpcore), 0, FSL_IMX6UL_A7MPCORE_ADDR); | ||
112 | |||
113 | - for (i = 0; i < smp_cpus; i++) { | ||
114 | - SysBusDevice *sbd = SYS_BUS_DEVICE(&s->a7mpcore); | ||
115 | - DeviceState *d = DEVICE(qemu_get_cpu(i)); | ||
116 | + sbd = SYS_BUS_DEVICE(&s->a7mpcore); | ||
117 | + d = DEVICE(&s->cpu); | ||
118 | |||
119 | - irq = qdev_get_gpio_in(d, ARM_CPU_IRQ); | ||
120 | - sysbus_connect_irq(sbd, i, irq); | ||
121 | - sysbus_connect_irq(sbd, i + smp_cpus, qdev_get_gpio_in(d, ARM_CPU_FIQ)); | ||
122 | - sysbus_connect_irq(sbd, i + 2 * smp_cpus, | ||
123 | - qdev_get_gpio_in(d, ARM_CPU_VIRQ)); | ||
124 | - sysbus_connect_irq(sbd, i + 3 * smp_cpus, | ||
125 | - qdev_get_gpio_in(d, ARM_CPU_VFIQ)); | ||
126 | - } | ||
127 | + sysbus_connect_irq(sbd, 0, qdev_get_gpio_in(d, ARM_CPU_IRQ)); | ||
128 | + sysbus_connect_irq(sbd, 1, qdev_get_gpio_in(d, ARM_CPU_FIQ)); | ||
129 | + sysbus_connect_irq(sbd, 2, qdev_get_gpio_in(d, ARM_CPU_VIRQ)); | ||
130 | + sysbus_connect_irq(sbd, 3, qdev_get_gpio_in(d, ARM_CPU_VFIQ)); | ||
131 | |||
132 | /* | ||
133 | * A7MPCORE DAP | ||
134 | diff --git a/hw/arm/mcimx6ul-evk.c b/hw/arm/mcimx6ul-evk.c | ||
135 | index XXXXXXX..XXXXXXX 100644 | ||
136 | --- a/hw/arm/mcimx6ul-evk.c | ||
137 | +++ b/hw/arm/mcimx6ul-evk.c | ||
138 | @@ -XXX,XX +XXX,XX @@ static void mcimx6ul_evk_init(MachineState *machine) | ||
139 | } | ||
140 | |||
141 | if (!qtest_enabled()) { | ||
142 | - arm_load_kernel(&s->soc.cpu[0], &boot_info); | ||
143 | + arm_load_kernel(&s->soc.cpu, &boot_info); | ||
144 | } | ||
145 | } | ||
146 | |||
147 | -- | ||
148 | 2.20.1 | ||
149 | |||
150 | diff view generated by jsdifflib |