ARM: Permit any ARMv6K CPU to read the MVFR0 and MVFR1 VFP registers.
PATCH 1/1 ARM: Permit any ARMv6K CPU to read the MVFR0 and MVFR1 VFP registers.
From: Andrew Towers <[email protected]>
Replaces the ARM_FEATURE_VFP3 check when reading MVFR0/1 with a check for ARM_FEATURE_V6K. Rationale: MVFR0/1 were introduced in the ARM1136 at the same time as ARMv6K, and a survey of TRMs indicates support in later models.
According to reference documentation on arm.com, MVFR0 and MVFR1 were introduced in ARM1136JF-S r1p1 (ARMv6K, VFPv2). They are also present in ARM1156T2F-S and ARM1176JZF-S, which contain VFP11 r5, and in ARM11 MPCore r1 which contains VFP11 r4.
Reference (ARM DDI 0211H, 0290G, 0301H, 0360E)
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0211h/Ffbefjag.html
Without this change, the linux kernel will not boot with VFP support enabled under ARM1176 system emulation, due to the unconditional use of MVFR1 at the end of vfp_init() in arch/arm/vfp/vfpmodule.c in the kernel:
VFP support v0.3: implemetor 41 architecture 1 part 20 variant b rev 5
Internal error: Oops - undefined instruction: 0 [#1]
Yes, I am slightly abusing the versatilepb hw emulation, but then so is everyone else in the world who is still waiting for their Raspberry Pi ;)
--- target-arm/translate.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
target-arm/translate.c +1 -1
@@ -2906,7 +2906,7 @@ static int disas_vfp_insn(CPUARMState * env, DisasContext *s, uint32_t insn)case ARM_VFP_MVFR0 :case ARM_VFP_MVFR1 :if (IS_USER (s) - || !arm_feature (env,ARM_FEATURE_VFP3 )) + || !arm_feature (env,ARM_FEATURE_V6K ))return 1 ; tmp =load_cpu_field (vfp.xregs[rn]);break ;
Signature · 1 line
1.7.5.4
Quoted 6 lines · Andrew Towers
From: Andrew Towers <[email protected]>
Replaces the
ARM_FEATURE_VFP3check when reading MVFR0/1 with a check forARM_FEATURE_V6K. Rationale: MVFR0/1 were introduced in the ARM1136 at the same time as ARMv6K, and a survey of TRMs indicates support in later models.
Quoted 7 lines
According to reference documentation on arm.com, MVFR0 and MVFR1 were introduced in ARM1136JF-S r1p1 (ARMv6K, VFPv2). They are also present in ARM1156T2F-S and ARM1176JZF-S, which contain VFP11 r5, and in ARM11 MPCore r1 which contains VFP11 r4.
Reference (ARM DDI 0211H, 0290G, 0301H, 0360E)
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0211h/Ffbefjag.html
Unfortunately I think the ARM1156 is the exception which demonstrates that this isn't a V6K feature. The 1156 isn't V6K (it doesn't have the TLS registers or the byte/half/doubleword load/store exclusive instructions), but it does have the MVFR* registers. So I think we need a new ARM_FEATURE_MVFR flag, and in cpu_reset_model_id() have V6K imply MVFR.
Quoted 2 lines
Yes, I am slightly abusing the versatilepb hw emulation, but then so is everyone else in the world who is still waiting for their Raspberry Pi ;)
...I've been wondering if anybody's going to submit patches for an actual rPi board model :-)
-- PMM
PATCH v2 1/1 ARM: Permit any ARMv6K CPU to read the MVFR0 and MVFR1 VFP registers.
This patch replaces the ARM_FEATURE_VFP3 test when reading MVFR registers with a test for a new feature flag ARM_FEATURE_MVFR, and sets this feature for all ARMv6K cores (ARM1156 is not a v6K core, yet supports MVFR; qemu does not support ARM1156 at this time.)
MVFR0 and MVFR1 were introduced in ARM1136JF-S r1p0 (ARMv6K, VFPv2) and are present in ARM1156T2F-S (non-v6K), ARM1176JZF-S, ARM11MPCore and newer cores.
Reference: ARM DDI 0211H, 0290G, 0301H, 0360E.
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0211h/Ffbefjag.html
Without this change, the linux kernel will not boot with VFP support enabled under ARM1176 system emulation, due to the unconditional use of MVFR1 at the end of vfp_init() in arch/arm/vfp/vfpmodule.c:
VFP support v0.3: implemetor 41 architecture 1 part 20 variant b rev 5
Internal error: Oops - undefined instruction: 0 [#1]
---
v2:
* introduced ARM_FEATURE_MVFR, implied by ARM_FEATURE_V6K.
Paul: I'd love to work on an rPi board model, and I'll see what I can put together, but much of the hardware is under NDA and I'm not in the loop..
target-arm/cpu.h | 1 + target-arm/helper.c | 1 + target-arm/translate.c | 2 +- 3 files changed, 3 insertions(+), 1 deletions(-)
target-arm/cpu.h +1 -0
@@ -383,6 +383,7 @@ enum arm_features {ARM_FEATURE_ARM_DIV ,/* divide supported in ARM encoding */ ARM_FEATURE_VFP4 ,/* VFPv4 (implies that NEON is v2) */ ARM_FEATURE_GENERIC_TIMER , + ARM_FEATURE_MVFR, /* Media and VFP Feature Registers 0 and 1 */ };static inline int arm_feature (CPUARMState *env,int feature)
target-arm/helper.c +1 -0
@@ -254,6 +254,7 @@ static void cpu_reset_model_id(CPUARMState *env, uint32_t id) }if (arm_feature (env,ARM_FEATURE_V6K )) {set_feature (env,ARM_FEATURE_V6 ); +set_feature (env,ARM_FEATURE_MVFR ); }if (arm_feature (env,ARM_FEATURE_V6 )) {set_feature (env,ARM_FEATURE_V5 );
target-arm/translate.c +1 -1
@@ -2906,7 +2906,7 @@ static int disas_vfp_insn(CPUARMState * env, DisasContext *s, uint32_t insn)case ARM_VFP_MVFR0 :case ARM_VFP_MVFR1 :if (IS_USER (s) - || !arm_feature (env,ARM_FEATURE_VFP3 )) + || !arm_feature (env,ARM_FEATURE_MVFR ))return 1 ; tmp =load_cpu_field (vfp.xregs[rn]);break ;
Signature · 1 line
1.7.5.4
Am 29.03.2012 14:41, schrieb Andrew Towers:
Quoted 10 lines
This patch replaces the
ARM_FEATURE_VFP3test when reading MVFR registers with a test for a new feature flagARM_FEATURE_MVFR, and sets this feature for all ARMv6K cores (ARM1156 is not a v6K core, yet supports MVFR; qemu does not support ARM1156 at this time.)MVFR0 and MVFR1 were introduced in ARM1136JF-S r1p0 (ARMv6K, VFPv2) and are present in ARM1156T2F-S (non-v6K), ARM1176JZF-S, ARM11MPCore and newer cores.
Reference: ARM DDI 0211H, 0290G, 0301H, 0360E.
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0211h/Ffbefjag.html
Quoted 8 lines
Without this change, the linux kernel will not boot with VFP support enabled under ARM1176 system emulation, due to the unconditional use of MVFR1 at the end of
vfp_init()inarch/arm/vfp/vfpmodule.c:VFP support v0.3: implemetor 41 architecture 1 part 20 variant b rev 5
Internal error: Oops - undefined instruction: 0 [#1]Signed-off-by Andrew Towers <[email protected]>
Feature inference looks good,
Quoted 7 lines
---
v2:
* introducedARM_FEATURE_MVFR, implied byARM_FEATURE_V6K.Paul: I'd love to work on an rPi board model, and I'll see what I can put together, but much of the hardware is under NDA and I'm not in the loop..
You might find the partial bcm2835 manual helpful:
http://www.raspberrypi.org/archives/615
Open-source drivers (esp. Linux) are also often a helpful source for emulating NDA'ed hardware.
Regards,
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Quoted 4 lines · Andrew Towers
This patch replaces the
ARM_FEATURE_VFP3test when reading MVFR registers with a test for a new feature flagARM_FEATURE_MVFR, and sets this feature for all ARMv6K cores (ARM1156 is not a v6K core, yet supports MVFR; qemu does not support ARM1156 at this time.)
and put into target-arm.next. I'll probably do a pullreq tomorrow.
Thanks!
-- PMM