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

> 
> On 16 Jun 2014, at 22:13, Mark R V Murray <ma...@freebsd.org> wrote:
> 
>> 
>> On 16 Jun 2014, at 20:38, Michael Tuexen <tue...@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
>> 
>> 
> 
> 
> 

_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to