From: "Cédric Le Goater" <clg@kaod.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Peter Crosthwaite" <crosthwaite.peter@gmail.com>,
"Andrew Jeffery" <andrew@aj.id.au>,
"Marcin Krzeminski" <marcin.krzeminski@nokia.com>,
qemu-devel@nongnu.org, qemu-arm@nongnu.org,
"Cédric Le Goater" <clg@kaod.org>
Subject: [Qemu-devel] [PATCH for-2.9 01/30] target-arm: Add VBAR support to ARM1176 CPUs
Date: Tue, 29 Nov 2016 16:43:39 +0100 [thread overview]
Message-ID: <1480434248-27138-2-git-send-email-clg@kaod.org> (raw)
In-Reply-To: <1480434248-27138-1-git-send-email-clg@kaod.org>
ARM1176 CPUs support the Vector Base Address Register but currently,
qemu only supports VBAR on ARMv7 CPUs. Fix this by adding a new
feature ARM_FEATURE_VBAR which can used for ARMv7 and ARM1176 CPUs.
The VBAR feature is always set for ARMv7 because some legacy boards
require it even if this is not architecturally correct. However, to
support arm1176 CPUs without TrustZone, which doesn't exist in real
hardware but which is used in old qemu boards, we need to disable the
feature when 'has_el3' is not set.
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
target-arm/cpu.c | 6 ++++++
target-arm/cpu.h | 1 +
target-arm/helper.c | 24 ++++++++++++++++++------
3 files changed, 25 insertions(+), 6 deletions(-)
diff --git a/target-arm/cpu.c b/target-arm/cpu.c
index 99f0dbebb9f6..1007e504248a 100644
--- a/target-arm/cpu.c
+++ b/target-arm/cpu.c
@@ -685,6 +685,11 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
*/
cpu->id_pfr1 &= ~0xf0;
cpu->id_aa64pfr0 &= ~0xf000;
+
+ /* Also disable VBAR support for boards using a arm1176 CPU
+ * without EL3.
+ */
+ unset_feature(env, ARM_FEATURE_VBAR);
}
if (!cpu->has_pmu || !kvm_enabled()) {
@@ -911,6 +916,7 @@ static void arm1176_initfn(Object *obj)
cpu->dtb_compatible = "arm,arm1176";
set_feature(&cpu->env, ARM_FEATURE_V6K);
+ set_feature(&cpu->env, ARM_FEATURE_VBAR);
set_feature(&cpu->env, ARM_FEATURE_VFP);
set_feature(&cpu->env, ARM_FEATURE_VAPA);
set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS);
diff --git a/target-arm/cpu.h b/target-arm/cpu.h
index ca5c849ed65e..ab119e62ab0f 100644
--- a/target-arm/cpu.h
+++ b/target-arm/cpu.h
@@ -1125,6 +1125,7 @@ enum arm_features {
ARM_FEATURE_V8_PMULL, /* implements PMULL part of v8 Crypto Extensions */
ARM_FEATURE_THUMB_DSP, /* DSP insns supported in the Thumb encodings */
ARM_FEATURE_PMU, /* has PMU support */
+ ARM_FEATURE_VBAR, /* has cp15 VBAR */
};
static inline int arm_feature(CPUARMState *env, int feature)
diff --git a/target-arm/helper.c b/target-arm/helper.c
index b5b65caadf8a..d417c8ba802f 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -1252,12 +1252,6 @@ static const ARMCPRegInfo v7_cp_reginfo[] = {
.access = PL1_RW, .accessfn = access_tpm, .type = ARM_CP_ALIAS,
.fieldoffset = offsetof(CPUARMState, cp15.c9_pminten),
.writefn = pmintenclr_write },
- { .name = "VBAR", .state = ARM_CP_STATE_BOTH,
- .opc0 = 3, .crn = 12, .crm = 0, .opc1 = 0, .opc2 = 0,
- .access = PL1_RW, .writefn = vbar_write,
- .bank_fieldoffsets = { offsetof(CPUARMState, cp15.vbar_s),
- offsetof(CPUARMState, cp15.vbar_ns) },
- .resetvalue = 0 },
{ .name = "CCSIDR", .state = ARM_CP_STATE_BOTH,
.opc0 = 3, .crn = 0, .crm = 0, .opc1 = 1, .opc2 = 0,
.access = PL1_R, .readfn = ccsidr_read, .type = ARM_CP_NO_RAW },
@@ -1412,6 +1406,16 @@ static const ARMCPRegInfo v6k_cp_reginfo[] = {
REGINFO_SENTINEL
};
+static const ARMCPRegInfo vbar_cp_reginfo[] = {
+ { .name = "VBAR", .state = ARM_CP_STATE_BOTH,
+ .opc0 = 3, .crn = 12, .crm = 0, .opc1 = 0, .opc2 = 0,
+ .access = PL1_RW, .writefn = vbar_write,
+ .bank_fieldoffsets = { offsetof(CPUARMState, cp15.vbar_s),
+ offsetof(CPUARMState, cp15.vbar_ns) },
+ .resetvalue = 0 },
+ REGINFO_SENTINEL
+};
+
#ifndef CONFIG_USER_ONLY
static CPAccessResult gt_cntfrq_access(CPUARMState *env, const ARMCPRegInfo *ri,
@@ -4506,6 +4510,9 @@ void register_cp_regs_for_features(ARMCPU *cpu)
if (arm_feature(env, ARM_FEATURE_V6K)) {
define_arm_cp_regs(cpu, v6k_cp_reginfo);
}
+ if (arm_feature(env, ARM_FEATURE_VBAR)) {
+ define_arm_cp_regs(cpu, vbar_cp_reginfo);
+ }
if (arm_feature(env, ARM_FEATURE_V7MP) &&
!arm_feature(env, ARM_FEATURE_MPU)) {
define_arm_cp_regs(cpu, v7mp_cp_reginfo);
@@ -4543,6 +4550,11 @@ void register_cp_regs_for_features(ARMCPU *cpu)
};
define_one_arm_cp_reg(cpu, &clidr);
define_arm_cp_regs(cpu, v7_cp_reginfo);
+
+ /* Always define VBAR even if it doesn't exist in non-EL3
+ * configs. This is needed by some legacy boards.
+ */
+ define_arm_cp_regs(cpu, vbar_cp_reginfo);
define_debug_regs(cpu);
} else {
define_arm_cp_regs(cpu, not_v7_cp_reginfo);
--
2.7.4
next prev parent reply other threads:[~2016-11-29 15:47 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-29 15:43 [Qemu-arm] [PATCH for-2.9 00/30] Aspeed SoC fixes and model improvements Cédric Le Goater
2016-11-29 15:43 ` Cédric Le Goater [this message]
2016-12-14 15:43 ` [Qemu-arm] [PATCH for-2.9 01/30] target-arm: Add VBAR support to ARM1176 CPUs Peter Maydell
2016-11-29 15:43 ` [Qemu-arm] [PATCH for-2.9 02/30] m25p80: add support for the mx66l1g45g Cédric Le Goater
2016-11-29 15:43 ` [Qemu-arm] [PATCH for-2.9 03/30] aspeed: QOMify the CPU object and attach it to the SoC Cédric Le Goater
2016-11-29 15:43 ` [Qemu-arm] [PATCH for-2.9 04/30] aspeed: remove cannot_destroy_with_object_finalize_yet Cédric Le Goater
2016-11-29 15:43 ` [Qemu-arm] [PATCH for-2.9 05/30] aspeed: attach the second SPI controller object to the SoC Cédric Le Goater
2016-11-29 15:43 ` [Qemu-arm] [PATCH for-2.9 06/30] aspeed: extend the board configuration with flash models Cédric Le Goater
2016-11-29 15:43 ` [Qemu-devel] [PATCH for-2.9 07/30] aspeed: add support for the romulus-bmc board Cédric Le Goater
2016-11-29 15:43 ` [Qemu-devel] [PATCH for-2.9 08/30] aspeed: add a memory region for SRAM Cédric Le Goater
2016-11-29 15:43 ` [Qemu-arm] [PATCH for-2.9 09/30] aspeed: add the definitions for the AST2400 A1 SoC Cédric Le Goater
2016-11-29 15:43 ` [Qemu-devel] [PATCH for-2.9 10/30] aspeed: change SoC revision of the palmetto-bmc machine Cédric Le Goater
2016-11-29 15:43 ` [Qemu-arm] [PATCH for-2.9 11/30] aspeed/scu: fix SCU region size Cédric Le Goater
2016-11-29 15:43 ` [Qemu-devel] [PATCH for-2.9 12/30] aspeed/smc: improve segment register support Cédric Le Goater
2016-11-29 15:43 ` [Qemu-arm] [PATCH for-2.9 13/30] aspeed/smc: set the number of flash modules for the FMC controller Cédric Le Goater
2016-11-29 15:43 ` [Qemu-arm] [PATCH for-2.9 14/30] aspeed/smc: rework the prototype of the AspeedSMCFlash helper routines Cédric Le Goater
2016-12-14 17:09 ` Peter Maydell
2016-12-15 13:38 ` Cédric Le Goater
2016-11-29 15:43 ` [Qemu-arm] [PATCH for-2.9 15/30] aspeed/smc: introduce a aspeed_smc_flash_update_cs() helper Cédric Le Goater
2016-11-29 15:43 ` [Qemu-devel] [PATCH for-2.9 16/30] aspeed/smc: autostrap CE0/1 configuration Cédric Le Goater
2016-11-29 15:43 ` [Qemu-devel] [PATCH for-2.9 17/30] aspeed/smc: handle SPI flash Command mode Cédric Le Goater
2016-12-04 16:31 ` [Qemu-arm] " mar.krzeminski
2016-12-05 14:07 ` Cédric Le Goater
2016-12-05 15:33 ` [Qemu-arm] " mar.krzeminski
2017-01-02 15:56 ` Cédric Le Goater
2017-01-02 17:33 ` [Qemu-arm] " mar.krzeminski
2017-01-02 18:02 ` Cédric Le Goater
2017-01-02 18:21 ` mar.krzeminski
2017-01-03 10:50 ` Cédric Le Goater
2016-11-29 15:43 ` [Qemu-arm] [PATCH for-2.9 18/30] aspeed/smc: extend tests for " Cédric Le Goater
2016-11-29 15:43 ` [Qemu-arm] [PATCH for-2.9 19/30] aspeed/smc: unfold the AspeedSMCController array Cédric Le Goater
2016-11-29 15:43 ` [Qemu-arm] [PATCH for-2.9 20/30] aspeed/smc: add a 'sdram_base' property Cédric Le Goater
2016-11-29 15:43 ` [Qemu-devel] [PATCH for-2.9 21/30] aspeed/smc: add support for DMAs Cédric Le Goater
2016-11-29 15:44 ` [Qemu-arm] [PATCH for-2.9 22/30] aspeed/smc: handle dummy bytes when doing fast reads Cédric Le Goater
2016-12-04 16:46 ` [Qemu-arm] [Qemu-devel] " mar.krzeminski
2016-12-05 14:14 ` Cédric Le Goater
2016-12-05 15:12 ` mar.krzeminski
2016-11-29 15:44 ` [Qemu-arm] [PATCH for-2.9 23/30] aspeed/smc: adjust the size of the register region Cédric Le Goater
2016-11-29 15:44 ` [Qemu-devel] [PATCH for-2.9 24/30] aspeed: use first SPI flash as a boot ROM Cédric Le Goater
2016-12-04 17:00 ` [Qemu-arm] " mar.krzeminski
2016-12-05 9:36 ` Cédric Le Goater
2016-12-05 9:57 ` [Qemu-arm] " Marcin Krzemiński
2016-12-05 14:53 ` Cédric Le Goater
2016-12-05 15:09 ` mar.krzeminski
2016-11-29 15:44 ` [Qemu-arm] [PATCH for-2.9 25/30] block: add a model option for MTD devices Cédric Le Goater
2016-11-29 16:06 ` Cédric Le Goater
2016-11-29 17:30 ` Cédric Le Goater
2016-11-29 18:08 ` [Qemu-devel] " Kevin Wolf
2016-11-30 15:09 ` Cédric Le Goater
2016-11-30 15:55 ` [Qemu-arm] " Kevin Wolf
2016-11-29 15:44 ` [Qemu-devel] [PATCH for-2.9 26/30] aspeed/smc: use flash model option Cédric Le Goater
2016-11-30 16:26 ` Cédric Le Goater
2016-11-29 15:44 ` [Qemu-arm] [PATCH for-2.9 27/30] wdt: Add Aspeed watchdog device model Cédric Le Goater
2017-01-16 17:14 ` Cédric Le Goater
2016-11-29 15:44 ` [Qemu-devel] [PATCH for-2.9 28/30] aspeed: add a watchdog controller Cédric Le Goater
2016-11-30 2:01 ` [Qemu-arm] " Andrew Jeffery
2016-11-29 16:07 ` [Qemu-devel] [PATCH for-2.9 29/30] aspeed/scu: add a aspeed_scu_get_clk() helper Cédric Le Goater
2016-11-29 16:07 ` [Qemu-devel] [PATCH for-2.9 30/30] wdt: aspeed: use scu to get clock freq Cédric Le Goater
2016-11-29 19:17 ` [Qemu-arm] " Cédric Le Goater
2016-11-29 19:16 ` [Qemu-arm] [PATCH for-2.9 29/30] aspeed/scu: add a aspeed_scu_get_clk() helper Cédric Le Goater
2016-11-29 17:26 ` [Qemu-devel] " Cédric Le Goater
2016-11-29 17:26 ` [Qemu-arm] [PATCH for-2.9 30/30] wdt: aspeed: use scu to get clock freq Cédric Le Goater
2016-12-14 17:12 ` [Qemu-arm] [PATCH for-2.9 00/30] Aspeed SoC fixes and model improvements Peter Maydell
2016-12-14 17:51 ` Cédric Le Goater
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1480434248-27138-2-git-send-email-clg@kaod.org \
--to=clg@kaod.org \
--cc=andrew@aj.id.au \
--cc=crosthwaite.peter@gmail.com \
--cc=marcin.krzeminski@nokia.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).