svn commit: r266083 - in head/sys/arm: arm include

Michael Tuexen tuexen at freebsd.org
Mon Jun 16 23:09:38 UTC 2014


On 16 Jun 2014, at 22:41, Michael Tuexen <tuexen at freebsd.org> wrote:

> 
> On 16 Jun 2014, at 22:13, Mark R V Murray <markm at FreeBSD.org> wrote:
> 
>> 
>> On 16 Jun 2014, at 20:38, Michael Tuexen <tuexen at freebsd.org> wrote:
>>> Hmm, the documentation reads
>> 
>> Which docs are you using?
>> 
>> I’m using DDI0360F. (And that could easily be a wrong choice).
> That is what I'm also looking at. Selecting ARM1176...
> 
> The code regarding _PMC_USER_READ_WRITE_ also needs to be adopted.
> I need to test it... I'll come back in a couple of hours...
Using the following updated patch in addition to your patch:

Index: cpufunc.c
===================================================================
--- cpufunc.c	(revision 267555)
+++ cpufunc.c	(working copy)
@@ -1409,7 +1409,20 @@
  * BEWARE! This gives write access also, which may not be what
  * you want!
  */
+#if defined(CPU_ARM1136) || defined(CPU_ARM1176)
 #ifdef _PMC_USER_READ_WRITE_
+	/* Use Secure User and Non-secure Access Validation Control Register
+	   to allow userland access */
+	__asm volatile ("mcr	p15, 0, %0, c15, c9, 0\n\t"
+			:
+			: "r"(0x00000001));
+#endif
+	/* Set PMCR[2,0] to enable counters and reset CCNT */
+	__asm volatile ("mcr	p15, 0, %0, c15, c12, 0\n\t"
+			:
+			: "r"(0x00000005));
+#else
+#ifdef _PMC_USER_READ_WRITE_
 	/* Set PMUSERENR[0] to allow userland access */
 	__asm volatile ("mcr	p15, 0, %0, c9, c14, 0\n\t"
 			:
@@ -1426,6 +1439,7 @@
 			: "r"(0xFFFFFFFF),
 			  "r"(0x00000005),
 			  "r"(0x80000000));
+#endif
 }
 #endif

allows your test program to run successfully without root privileges, if I compile the
kernel with _PMC_USER_READ_WRITE_ defined.

Best regards
Michael
> 
> Best regards
> Michael 
>> 
>> M
>> -- 
>> Mark R V Murray
>> 
>> 
> 
> 
> 



More information about the svn-src-head mailing list