Date: Sun, 22 Jun 2014 21:04:14 GMT From: astarasikov@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r269884 - in soc2014/astarasikov/head/sys/arm: arm include Message-ID: <201406222104.s5ML4E8U023590@socsvn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: astarasikov Date: Sun Jun 22 21:04:13 2014 New Revision: 269884 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=269884 Log: arm: do not use performance counters in QEMU Currently Android Emulator and older versions of QEMU will trap if performance counters are accessed via CP15. This patch provides a workaround for it. Modified: soc2014/astarasikov/head/sys/arm/arm/cpufunc.c soc2014/astarasikov/head/sys/arm/include/cpu.h Modified: soc2014/astarasikov/head/sys/arm/arm/cpufunc.c ============================================================================== --- soc2014/astarasikov/head/sys/arm/arm/cpufunc.c Sun Jun 22 21:03:09 2014 (r269883) +++ soc2014/astarasikov/head/sys/arm/arm/cpufunc.c Sun Jun 22 21:04:13 2014 (r269884) @@ -1405,6 +1405,9 @@ static __inline void cpu_scc_setup_ccnt(void) { +#if defined(QEMU_WORKAROUNDS) + return; +#else /* This is how you give userland access to the CCNT and PMCn * registers. * BEWARE! This gives write access also, which may not be what @@ -1427,6 +1430,7 @@ : "r"(0xFFFFFFFF), "r"(0x00000005), "r"(0x80000000)); +#endif } #endif Modified: soc2014/astarasikov/head/sys/arm/include/cpu.h ============================================================================== --- soc2014/astarasikov/head/sys/arm/include/cpu.h Sun Jun 22 21:03:09 2014 (r269883) +++ soc2014/astarasikov/head/sys/arm/include/cpu.h Sun Jun 22 21:04:13 2014 (r269884) @@ -15,9 +15,15 @@ get_cyclecount(void) { /* This '#if' asks the question 'Does CP15/SCC include performance counters?' */ -#if defined(CPU_ARM1136) || defined(CPU_ARM1176) \ + +/* QEMU has got support for emulating performance counters + * around march 2014. Android Emulator is lagging behind and will + * die with 'unimplemented cp15 register read' trap. + * Maybe one day we can revert QEMU_WORKAROUNDS */ +#if (defined(CPU_ARM1136) || defined(CPU_ARM1176) \ || defined(CPU_MV_PJ4B) \ - || defined(CPU_CORTEXA) || defined(CPU_KRAIT) + || defined(CPU_CORTEXA) || defined(CPU_KRAIT)) \ + && !defined(QEMU_WORKAROUNDS) uint32_t ccnt; uint64_t ccnt64;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406222104.s5ML4E8U023590>