svn commit: r359909 - in head/sys/contrib/ck/include: . gcc/arm

2020-04-13 Thread Olivier Houchard
Author: cognet
Date: Mon Apr 13 23:16:32 2020
New Revision: 359909
URL: https://svnweb.freebsd.org/changeset/base/359909

Log:
  Remove FreeBSD/armv4 specific bits from CK.
  
  Now that armv4/v5 is gone, remove the bits that implemented atomic operations
  by disabling interrupts.
  Those were specific to FreeBSD and never reached upstream.

Deleted:
  head/sys/contrib/ck/include/gcc/arm/ck_pr_armv4.h
Modified:
  head/sys/contrib/ck/include/ck_pr.h

Modified: head/sys/contrib/ck/include/ck_pr.h
==
--- head/sys/contrib/ck/include/ck_pr.h Mon Apr 13 23:06:56 2020
(r359908)
+++ head/sys/contrib/ck/include/ck_pr.h Mon Apr 13 23:16:32 2020
(r359909)
@@ -48,11 +48,7 @@
 #elif defined(__ppc__)
 #include "gcc/ppc/ck_pr.h"
 #elif defined(__arm__)
-#if __ARM_ARCH >= 6
 #include "gcc/arm/ck_pr.h"
-#else
-#include "gcc/arm/ck_pr_armv4.h"
-#endif
 #elif defined(__aarch64__)
 #include "gcc/aarch64/ck_pr.h"
 #elif !defined(__GNUC__)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358290 - head/sys/arm64/arm64

2020-02-24 Thread Olivier Houchard
Author: cognet
Date: Mon Feb 24 16:25:11 2020
New Revision: 358290
URL: https://svnweb.freebsd.org/changeset/base/358290

Log:
  debug_monitor: Avoid setting the PSR_D flag for 32bits binaries.
  
  In dbg_monitor_exit(), avoid setting the PSR_D bit if the process is
  a 32bits binary. PSR_D is an aarch64-only flags, and for aarch32 processes,
  it means "run in big endian".
  This should make COMPAT_FREEBSD32 run much better on arm64.

Modified:
  head/sys/arm64/arm64/debug_monitor.c

Modified: head/sys/arm64/arm64/debug_monitor.c
==
--- head/sys/arm64/arm64/debug_monitor.cMon Feb 24 15:35:31 2020
(r358289)
+++ head/sys/arm64/arm64/debug_monitor.cMon Feb 24 16:25:11 2020
(r358290)
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -534,7 +535,13 @@ dbg_monitor_exit(struct thread *thread, struct trapfra
 {
int i;
 
-   frame->tf_spsr |= PSR_D;
+   /*
+* PSR_D is an aarch64-only flag. On aarch32, it switches
+* the processor to big-endian, so avoid setting it for
+* 32bits binaries.
+*/
+   if (!(SV_PROC_FLAG(thread->td_proc, SV_ILP32)))
+   frame->tf_spsr |= PSR_D;
if ((thread->td_pcb->pcb_dbg_regs.dbg_flags & DBGMON_ENABLED) != 0) {
/* Install the kernel version of the registers */
dbg_register_sync(>td_pcb->pcb_dbg_regs);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355332 - stable/11/sys/compat/linprocfs

2019-12-03 Thread Olivier Houchard
Author: cognet
Date: Tue Dec  3 16:33:35 2019
New Revision: 355332
URL: https://svnweb.freebsd.org/changeset/base/355332

Log:
  MFC r354602
  
linprocfs: Make sure to report -1 as tty when we have no controlling tty.
  
When reporting a process' stats, we can't just provide the tty as an
unsigned long, as if we have no controlling tty, the tty would be NODEV, or
-1. Instaed, just special-case NODEV.

Modified:
  stable/11/sys/compat/linprocfs/linprocfs.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linprocfs/linprocfs.c
==
--- stable/11/sys/compat/linprocfs/linprocfs.c  Tue Dec  3 16:32:30 2019
(r355331)
+++ stable/11/sys/compat/linprocfs/linprocfs.c  Tue Dec  3 16:33:35 2019
(r355332)
@@ -618,7 +618,10 @@ linprocfs_doprocstat(PFS_FILL_ARGS)
PS_ADD("pgrp",  "%d",   p->p_pgid);
PS_ADD("session",   "%d",   p->p_session->s_sid);
PROC_UNLOCK(p);
-   PS_ADD("tty",   "%ju",  (uintmax_t)kp.ki_tdev);
+   if (kp.ki_tdev == NODEV)
+   PS_ADD("tty",   "%s",   "-1");
+   else
+   PS_ADD("tty",   "%ju",  (uintmax_t)kp.ki_tdev);
PS_ADD("tpgid", "%d",   kp.ki_tpgid);
PS_ADD("flags", "%u",   0); /* XXX */
PS_ADD("minflt","%lu",  kp.ki_rusage.ru_minflt);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355331 - stable/12/sys/compat/linprocfs

2019-12-03 Thread Olivier Houchard
Author: cognet
Date: Tue Dec  3 16:32:30 2019
New Revision: 355331
URL: https://svnweb.freebsd.org/changeset/base/355331

Log:
  MFC r354602
  
linprocfs: Make sure to report -1 as tty when we have no controlling tty.
  
When reporting a process' stats, we can't just provide the tty as an
unsigned long, as if we have no controlling tty, the tty would be NODEV, or
-1. Instaed, just special-case NODEV.

Modified:
  stable/12/sys/compat/linprocfs/linprocfs.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/compat/linprocfs/linprocfs.c
==
--- stable/12/sys/compat/linprocfs/linprocfs.c  Tue Dec  3 15:48:28 2019
(r355330)
+++ stable/12/sys/compat/linprocfs/linprocfs.c  Tue Dec  3 16:32:30 2019
(r355331)
@@ -737,7 +737,10 @@ linprocfs_doprocstat(PFS_FILL_ARGS)
PS_ADD("pgrp",  "%d",   p->p_pgid);
PS_ADD("session",   "%d",   p->p_session->s_sid);
PROC_UNLOCK(p);
-   PS_ADD("tty",   "%ju",  (uintmax_t)kp.ki_tdev);
+   if (kp.ki_tdev == NODEV)
+   PS_ADD("tty",   "%s",   "-1");
+   else
+   PS_ADD("tty",   "%ju",  (uintmax_t)kp.ki_tdev);
PS_ADD("tpgid", "%d",   kp.ki_tpgid);
PS_ADD("flags", "%u",   0); /* XXX */
PS_ADD("minflt","%lu",  kp.ki_rusage.ru_minflt);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r354714 - in head/sys: arm64/arm64 arm64/conf arm64/include conf

2019-11-14 Thread Olivier Houchard
On Thu, Nov 14, 2019 at 03:24:30PM -0700, Ian Lepore wrote:
> On Thu, 2019-11-14 at 21:58 +, Justin Hibbits wrote:
> > Author: jhibbits
> > Date: Thu Nov 14 21:58:40 2019
> > New Revision: 354714
> > URL: https://svnweb.freebsd.org/changeset/base/354714
> > 
> > Log:
> >   Boot arm64 kernel using booti command from U-boot.
> >   
> > [...]
> > 
> > Added: head/sys/arm64/arm64/machdep_boot.c
> > =
> > =
> > --- /dev/null   00:00:00 1970   (empty, because file is newly added)
> > +++ head/sys/arm64/arm64/machdep_boot.c Thu Nov 14 21:58:40
> > 2019(r354714)
> > @@ -0,0 +1,330 @@
> > +/*-
> > + * Copyright (c) 2019 Juniper Networks, Inc
> > + * Copyright (c) 2004 Olivier Houchard
> > + * Copyright (c) 1994-1998 Mark Brinicombe.
> > + * Copyright (c) 1994 Brini.
> > + * All rights reserved.
> > + *
> > 
> 
> I think this copyright list should be pared down to just Olivier
> (maybe?) and Juniper.  The Brini lines are from when this code was part
> of machdep.c that was imported from netbsd in the 2004 timeframe.  That
> import did not include any of the code that got copied into this new
> arm64 file.  The code to handle embedded dtb and parsing bootargs in
> various ABI formats was all added much more recently, 2012-2014 time
> frame.
> 
> Warner should probably add himself to the copyrights though, I'm pretty
> sure he's the one who wrote the various flavors of bootargs parsers.
> 

There's actually still code of mine in this, well some descendant of it,
all the fake metadata business, but I'm amazed it's still used today,
especially on arm64, it was there to provide minimal infos back when we
had no real bootloader on arm.
Warner's copyright definitively belongs here.

Regards,

Olivier
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354602 - head/sys/compat/linprocfs

2019-11-10 Thread Olivier Houchard
Author: cognet
Date: Mon Nov 11 00:21:05 2019
New Revision: 354602
URL: https://svnweb.freebsd.org/changeset/base/354602

Log:
  linprocfs: Make sure to report -1 as tty when we have no controlling tty.
  
  When reporting a process' stats, we can't just provide the tty as an
  unsigned long, as if we have no controlling tty, the tty would be NODEV, or
  -1. Instaed, just special-case NODEV.
  
  Submitted by: Juraj Lutter 
  MFC after:1 week

Modified:
  head/sys/compat/linprocfs/linprocfs.c

Modified: head/sys/compat/linprocfs/linprocfs.c
==
--- head/sys/compat/linprocfs/linprocfs.c   Sun Nov 10 22:08:07 2019
(r354601)
+++ head/sys/compat/linprocfs/linprocfs.c   Mon Nov 11 00:21:05 2019
(r354602)
@@ -809,7 +809,10 @@ linprocfs_doprocstat(PFS_FILL_ARGS)
PS_ADD("pgrp",  "%d",   p->p_pgid);
PS_ADD("session",   "%d",   p->p_session->s_sid);
PROC_UNLOCK(p);
-   PS_ADD("tty",   "%ju",  (uintmax_t)kp.ki_tdev);
+   if (kp.ki_tdev == NODEV)
+   PS_ADD("tty",   "%s",   "-1");
+   else
+   PS_ADD("tty",   "%ju",  (uintmax_t)kp.ki_tdev);
PS_ADD("tpgid", "%d",   kp.ki_tpgid);
PS_ADD("flags", "%u",   0); /* XXX */
PS_ADD("minflt","%lu",  kp.ki_rusage.ru_minflt);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353435 - head/share/man/man7

2019-10-11 Thread Olivier Houchard
Author: cognet
Date: Fri Oct 11 13:34:09 2019
New Revision: 353435
URL: https://svnweb.freebsd.org/changeset/base/353435

Log:
  Document that aarch64 can now run armv6/armv7 binaries, but won't however
  run armv5 binaries.

Modified:
  head/share/man/man7/arch.7

Modified: head/share/man/man7/arch.7
==
--- head/share/man/man7/arch.7  Fri Oct 11 12:04:38 2019(r353434)
+++ head/share/man/man7/arch.7  Fri Oct 11 13:34:09 2019(r353435)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 9, 2019
+.Dd October 11, 2019
 .Dt ARCH 7
 .Os
 .Sh NAME
@@ -161,15 +161,18 @@ Examples are:
 .It Dv amd64   Ta Dv i386
 .It Dv powerpc64   Ta Dv powerpc
 .It Dv mips64* Ta Dv mips*
+.It Dv aarch64 Ta Dv armv6/armv7
 .El
 .Dv aarch64
-currently does not support execution of
+will support execution of
 .Dv armv6
 or
 .Dv armv7
-binaries, even if the CPU implements
+binaries if the CPU implements
 .Dv AArch32
-execution state.
+execution state, however
+.Dv armv5
+binaries aren't supported.
 .Pp
 On all supported architectures:
 .Bl -column -offset -indent "long long" "Size"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349444 - head/sys/arm64/arm64

2019-06-26 Thread Olivier Houchard
Author: cognet
Date: Wed Jun 26 22:06:40 2019
New Revision: 349444
URL: https://svnweb.freebsd.org/changeset/base/349444

Log:
  In get_fpcontext32() and set_fpcontext32(), we can't just use memcpy() to
  copy the VFP registers.
  arvm7 VFP uses 32 64bits fp registers (but those could be used in pairs to
  make 16 128bits registers), while aarch64 uses 32 128bits fp registers, so
  we have to copy the value of each register.

Modified:
  head/sys/arm64/arm64/freebsd32_machdep.c

Modified: head/sys/arm64/arm64/freebsd32_machdep.c
==
--- head/sys/arm64/arm64/freebsd32_machdep.cWed Jun 26 21:59:43 2019
(r349443)
+++ head/sys/arm64/arm64/freebsd32_machdep.cWed Jun 26 22:06:40 2019
(r349444)
@@ -122,6 +122,7 @@ static void
 get_fpcontext32(struct thread *td, mcontext32_vfp_t *mcp)
 {
struct pcb *curpcb;
+   int i;
 
critical_enter();
curpcb = curthread->td_pcb;
@@ -137,8 +138,8 @@ get_fpcontext32(struct thread *td, mcontext32_vfp_t *m
("Called get_fpcontext while the kernel is 
using the VFP"));
KASSERT((curpcb->pcb_fpflags & ~PCB_FP_USERMASK) == 0,
("Non-userspace FPU flags set in 
get_fpcontext"));
-   memcpy(mcp->mcv_reg, curpcb->pcb_fpustate.vfp_regs,
-   sizeof(mcp->mcv_reg));
+   for (i = 0; i < 32; i++)
+   mcp->mcv_reg[i] = 
(uint64_t)curpcb->pcb_fpustate.vfp_regs[i];
mcp->mcv_fpscr = 
VFP_FPSCR_FROM_SRCR(curpcb->pcb_fpustate.vfp_fpcr,
curpcb->pcb_fpustate.vfp_fpsr);
}
@@ -149,13 +150,14 @@ static void
 set_fpcontext32(struct thread *td, mcontext32_vfp_t *mcp)
 {
struct pcb *pcb;
+   int i;
 
critical_enter();
pcb = td->td_pcb;
if (td == curthread)
vfp_discard(td);
-   memcpy(pcb->pcb_fpustate.vfp_regs, mcp->mcv_reg,
-   sizeof(pcb->pcb_fpustate.vfp_regs));
+   for (i = 0; i < 32; i++)
+   pcb->pcb_fpustate.vfp_regs[i] = mcp->mcv_reg[i];
pcb->pcb_fpustate.vfp_fpsr = VFP_FPSR_FROM_FPSCR(mcp->mcv_fpscr);
pcb->pcb_fpustate.vfp_fpcr = VFP_FPSR_FROM_FPSCR(mcp->mcv_fpscr);
critical_exit();
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349426 - head/sys/arm64/arm64

2019-06-26 Thread Olivier Houchard
Author: cognet
Date: Wed Jun 26 16:56:56 2019
New Revision: 349426
URL: https://svnweb.freebsd.org/changeset/base/349426

Log:
  Fix debugging of 32bits arm binaries on arm64.
  
  In set_regs32()/fill_regs32(), we have to get/set SP and LR from/to
  tf_x[13] and tf_x[14].
  set_regs() and fill_regs() may be called for a 32bits process, if the process
  is ptrace'd from a 64bits debugger. So, in set_regs() and fill_regs(), get
  or set PC and SPSR from where the debugger expects it, from tf_x[15] and
  tf_x[16].

Modified:
  head/sys/arm64/arm64/machdep.c

Modified: head/sys/arm64/arm64/machdep.c
==
--- head/sys/arm64/arm64/machdep.c  Wed Jun 26 16:38:46 2019
(r349425)
+++ head/sys/arm64/arm64/machdep.c  Wed Jun 26 16:56:56 2019
(r349426)
@@ -194,6 +194,16 @@ fill_regs(struct thread *td, struct reg *regs)
 
memcpy(regs->x, frame->tf_x, sizeof(regs->x));
 
+#ifdef COMPAT_FREEBSD32
+   /*
+* We may be called here for a 32bits process, if we're using a
+* 64bits debugger. If so, put PC and SPSR where it expects it.
+*/
+   if (SV_PROC_FLAG(td->td_proc, SV_ILP32)) {
+   regs->x[15] = frame->tf_elr;
+   regs->x[16] = frame->tf_spsr;
+   }
+#endif
return (0);
 }
 
@@ -211,6 +221,17 @@ set_regs(struct thread *td, struct reg *regs)
 
memcpy(frame->tf_x, regs->x, sizeof(frame->tf_x));
 
+#ifdef COMPAT_FREEBSD32
+   if (SV_PROC_FLAG(td->td_proc, SV_ILP32)) {
+   /*
+* We may be called for a 32bits process if we're using
+* a 64bits debugger. If so, get PC and SPSR from where
+* it put it.
+*/
+   frame->tf_elr = regs->x[15];
+   frame->tf_spsr = regs->x[16] & PSR_FLAGS;
+   }
+#endif
return (0);
 }
 
@@ -283,8 +304,9 @@ fill_regs32(struct thread *td, struct reg32 *regs)
tf = td->td_frame;
for (i = 0; i < 13; i++)
regs->r[i] = tf->tf_x[i];
-   regs->r_sp = tf->tf_sp;
-   regs->r_lr = tf->tf_lr;
+   /* For arm32, SP is r13 and LR is r14 */
+   regs->r_sp = tf->tf_x[13];
+   regs->r_lr = tf->tf_x[14];
regs->r_pc = tf->tf_elr;
regs->r_cpsr = tf->tf_spsr;
 
@@ -300,8 +322,9 @@ set_regs32(struct thread *td, struct reg32 *regs)
tf = td->td_frame;
for (i = 0; i < 13; i++)
tf->tf_x[i] = regs->r[i];
-   tf->tf_sp = regs->r_sp;
-   tf->tf_lr = regs->r_lr;
+   /* For arm 32, SP is r13 an LR is r14 */
+   tf->tf_x[13] = regs->r_sp;
+   tf->tf_x[14] = regs->r_lr;
tf->tf_elr = regs->r_pc;
tf->tf_spsr = regs->r_cpsr;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r343007 - head/sys/arm64/arm64

2019-01-13 Thread Olivier Houchard
Author: cognet
Date: Sun Jan 13 23:41:56 2019
New Revision: 343007
URL: https://svnweb.freebsd.org/changeset/base/343007

Log:
  Don't forget to add the needed #includes.
  
  Pointy hat to:cognet

Modified:
  head/sys/arm64/arm64/cpufunc_asm.S

Modified: head/sys/arm64/arm64/cpufunc_asm.S
==
--- head/sys/arm64/arm64/cpufunc_asm.S  Sun Jan 13 23:29:46 2019
(r343006)
+++ head/sys/arm64/arm64/cpufunc_asm.S  Sun Jan 13 23:41:56 2019
(r343007)
@@ -29,8 +29,12 @@
  *
  */
 
+#include 
 #include 
 #include 
+
+#include "assym.inc"
+
 __FBSDID("$FreeBSD$");
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r343006 - in head/sys/arm64: arm64 include

2019-01-13 Thread Olivier Houchard
Author: cognet
Date: Sun Jan 13 23:29:46 2019
New Revision: 343006
URL: https://svnweb.freebsd.org/changeset/base/343006

Log:
  Introduce cpu_icache_sync_range_checked(), that does the same thing as
  cpu_icache_sync_range(), except that it sets pcb_onfault to catch any page
  fault, as doing cache maintenance operations for non-mapped generates a
  data abort, and use it in freebsd32_sysarch(), so that a userland program
  attempting to sync the icache with unmapped addresses doesn't crash the
  kernel.
  
  Spotted out by:   andrew

Modified:
  head/sys/arm64/arm64/cpufunc_asm.S
  head/sys/arm64/arm64/freebsd32_machdep.c
  head/sys/arm64/include/cpufunc.h

Modified: head/sys/arm64/arm64/cpufunc_asm.S
==
--- head/sys/arm64/arm64/cpufunc_asm.S  Sun Jan 13 20:33:54 2019
(r343005)
+++ head/sys/arm64/arm64/cpufunc_asm.S  Sun Jan 13 23:29:46 2019
(r343006)
@@ -147,3 +147,24 @@ ENTRY(arm64_icache_sync_range)
ic  ialluis
dsb ish
 END(arm64_icache_sync_range)
+
+/*
+ * int arm64_icache_sync_range_checked(vm_offset_t, vm_size_t)
+ */
+ENTRY(arm64_icache_sync_range_checked)
+   adr x5, cache_maint_fault
+   SET_FAULT_HANDLER(x5, x6)
+   /* XXX: See comment in arm64_icache_sync_range */
+   cache_handle_range  dcop = cvau
+   ic  ialluis
+   dsb ish
+   SET_FAULT_HANDLER(xzr, x6)
+   mov x0, #0
+   ret
+END(arm64_icache_sync_range_checked)
+
+ENTRY(cache_maint_fault)
+   SET_FAULT_HANDLER(xzr, x1)
+   mov x0, #EFAULT
+   ret
+END(cache_maint_fault)

Modified: head/sys/arm64/arm64/freebsd32_machdep.c
==
--- head/sys/arm64/arm64/freebsd32_machdep.cSun Jan 13 20:33:54 2019
(r343005)
+++ head/sys/arm64/arm64/freebsd32_machdep.cSun Jan 13 23:29:46 2019
(r343006)
@@ -85,7 +85,7 @@ freebsd32_sysarch(struct thread *td, struct freebsd32_
return (error);
if ((uint64_t)args.addr + (uint64_t)args.size > 
0x)
return (EINVAL);
-   cpu_icache_sync_range(args.addr, args.size);
+   cpu_icache_sync_range_checked(args.addr, args.size);
return 0;
}
case ARM_GET_VFPSTATE:

Modified: head/sys/arm64/include/cpufunc.h
==
--- head/sys/arm64/include/cpufunc.hSun Jan 13 20:33:54 2019
(r343005)
+++ head/sys/arm64/include/cpufunc.hSun Jan 13 23:29:46 2019
(r343006)
@@ -138,12 +138,14 @@ extern int64_t dczva_line_size;
 
 #definecpu_idcache_wbinv_range(a, s)   arm64_idcache_wbinv_range((a), 
(s))
 #definecpu_icache_sync_range(a, s) arm64_icache_sync_range((a), 
(s))
+#define cpu_icache_sync_range_checked(a, s) 
arm64_icache_sync_range_checked((a), (s))
 
 void arm64_nullop(void);
 void arm64_setttb(vm_offset_t);
 void arm64_tlb_flushID(void);
 void arm64_tlb_flushID_SE(vm_offset_t);
 void arm64_icache_sync_range(vm_offset_t, vm_size_t);
+int arm64_icache_sync_range_checked(vm_offset_t, vm_size_t);
 void arm64_idcache_wbinv_range(vm_offset_t, vm_size_t);
 void arm64_dcache_wbinv_range(vm_offset_t, vm_size_t);
 void arm64_dcache_inv_range(vm_offset_t, vm_size_t);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r343004 - in head/sys/arm64: arm64 conf include

2019-01-13 Thread Olivier Houchard
Author: cognet
Date: Sun Jan 13 19:49:46 2019
New Revision: 343004
URL: https://svnweb.freebsd.org/changeset/base/343004

Log:
  Impleent COMPAT_FREEBSD32 for arm64.
  This is based on early work by andrew@.

Modified:
  head/sys/arm64/arm64/elf32_machdep.c
  head/sys/arm64/arm64/freebsd32_machdep.c
  head/sys/arm64/arm64/identcpu.c
  head/sys/arm64/arm64/locore.S
  head/sys/arm64/arm64/machdep.c
  head/sys/arm64/arm64/undefined.c
  head/sys/arm64/arm64/vm_machdep.c
  head/sys/arm64/conf/GENERIC
  head/sys/arm64/include/armreg.h
  head/sys/arm64/include/elf.h
  head/sys/arm64/include/frame.h
  head/sys/arm64/include/reg.h
  head/sys/arm64/include/ucontext.h
  head/sys/arm64/include/vfp.h

Modified: head/sys/arm64/arm64/elf32_machdep.c
==
--- head/sys/arm64/arm64/elf32_machdep.cSun Jan 13 18:48:13 2019
(r343003)
+++ head/sys/arm64/arm64/elf32_machdep.cSun Jan 13 19:49:46 2019
(r343004)
@@ -1,6 +1,15 @@
 /*-
- * Copyright (c) 2017 Nuxi, https://nuxi.nl/
+ * Copyright (c) 2014, 2015 The FreeBSD Foundation.
+ * Copyright (c) 2014, 2017 Andrew Turner.
+ * Copyright (c) 2018 Olivier Houchard
+ * All rights reserved.
  *
+ * This software was developed by Andrew Turner under
+ * sponsorship from the FreeBSD Foundation.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -26,13 +35,225 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include 
-#define__ELF_WORD_SIZE 32
+#define__ELF_WORD_SIZE 32
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include 
+#include 
+#include 
+#include 
 
-void
-elf32_dump_thread(struct thread *td __unused, void *dst __unused,
-size_t *off __unused)
+#include 
+
+#include 
+
+#defineFREEBSD32_MINUSER   0x1000
+#defineFREEBSD32_MAXUSER   ((1ul << 32) - PAGE_SIZE)
+#defineFREEBSD32_SHAREDPAGE(FREEBSD32_MAXUSER - PAGE_SIZE)
+#defineFREEBSD32_USRSTACK  FREEBSD32_SHAREDPAGE
+
+extern const char *freebsd32_syscallnames[];
+
+extern char aarch32_sigcode[];
+extern int sz_aarch32_sigcode;
+
+static int freebsd32_fetch_syscall_args(struct thread *td);
+static void freebsd32_setregs(struct thread *td, struct image_params *imgp,
+   u_long stack);
+static void freebsd32_set_syscall_retval(struct thread *, int);
+
+static boolean_t elf32_arm_abi_supported(struct image_params *);
+
+extern void freebsd32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask);
+
+static struct sysentvec elf32_freebsd_sysvec = {
+   .sv_size= SYS_MAXSYSCALL,
+   .sv_table   = freebsd32_sysent,
+   .sv_errsize = 0,
+   .sv_errtbl  = NULL,
+   .sv_transtrap   = NULL,
+   .sv_fixup   = elf32_freebsd_fixup,
+   .sv_sendsig = freebsd32_sendsig,
+   .sv_sigcode = aarch32_sigcode,
+   .sv_szsigcode   = _aarch32_sigcode,
+   .sv_name= "FreeBSD ELF32",
+   .sv_coredump= elf32_coredump,
+   .sv_imgact_try  = NULL,
+   .sv_minsigstksz = MINSIGSTKSZ,
+   .sv_pagesize= PAGE_SIZE,
+   .sv_minuser = FREEBSD32_MINUSER,
+   .sv_maxuser = FREEBSD32_MAXUSER,
+   .sv_usrstack= FREEBSD32_USRSTACK,
+   .sv_psstrings   = FREEBSD32_PS_STRINGS,
+   .sv_stackprot   = VM_PROT_READ | VM_PROT_WRITE,
+   .sv_copyout_strings = freebsd32_copyout_strings,
+   .sv_setregs = freebsd32_setregs,
+   .sv_fixlimit= NULL, // XXX
+   .sv_maxssiz = NULL,
+   .sv_flags   = SV_ABI_FREEBSD | SV_ILP32 | SV_SHP | SV_TIMEKEEP,
+   .sv_set_syscall_retval = freebsd32_set_syscall_retval,
+   .sv_fetch_syscall_args = freebsd32_fetch_syscall_args,
+   .sv_syscallnames = freebsd32_syscallnames,
+   .sv_shared_page_base = FREEBSD32_SHAREDPAGE,
+   .sv_shared_page_len = PAGE_SIZE,
+   .sv_schedtail   = NULL,
+   .sv_thread_detach = NULL,
+   .sv_trap= NULL,
+};
+INIT_SYSENTVEC(elf32_sysvec, _freebsd_sysvec);
+
+static Elf32_Brandinfo freebsd32_brand_info = {
+   .brand  = ELFOSABI_FREEBSD,
+   .machine= EM_ARM,
+   .compat_3_brand = "FreeBSD",
+   .emul_path  = NULL,
+   .interp_path= "/libexec/ld-elf.so.1",
+   .sysvec = _freebsd_sysvec,
+   .interp_newpath = NULL,
+   .brand_note = _freebsd_brandnote,
+   .flags  = BI_CAN_EXEC_DYN | BI_BRAND_NOTE,
+   .header_supported= elf32_arm_abi_supported,
+};
+
+SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_FIRST,
+(sysinit_cfunc_t)elf32_insert_brand_entry, _brand_info);
+
+static boolean_t
+elf32_arm_abi_supported(struct image_params *imgp)
 {
+   c

svn commit: r342980 - head/sys/compat/freebsd32

2019-01-12 Thread Olivier Houchard
Author: cognet
Date: Sun Jan 13 00:38:55 2019
New Revision: 342980
URL: https://svnweb.freebsd.org/changeset/base/342980

Log:
  Regenerate sysent files after having modified syscalls.master.

Modified:
  head/sys/compat/freebsd32/freebsd32_proto.h
  head/sys/compat/freebsd32/freebsd32_syscalls.c
  head/sys/compat/freebsd32/freebsd32_sysent.c
  head/sys/compat/freebsd32/freebsd32_systrace_args.c

Modified: head/sys/compat/freebsd32/freebsd32_proto.h
==
--- head/sys/compat/freebsd32/freebsd32_proto.h Sun Jan 13 00:37:31 2019
(r342979)
+++ head/sys/compat/freebsd32/freebsd32_proto.h Sun Jan 13 00:38:55 2019
(r342980)
@@ -34,7 +34,7 @@ struct thread;
 #definePADR_(t)0
 #endif
 
-#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__))
+#if !defined(PAD64_REQUIRED) && !defined(__amd64__)
 #define PAD64_REQUIRED
 #endif
 struct freebsd32_wait4_args {
@@ -167,7 +167,7 @@ struct freebsd32___sysctl_args {
char namelen_l_[PADL_(u_int)]; u_int namelen; char 
namelen_r_[PADR_(u_int)];
char old_l_[PADL_(void *)]; void * old; char old_r_[PADR_(void *)];
char oldlenp_l_[PADL_(uint32_t *)]; uint32_t * oldlenp; char 
oldlenp_r_[PADR_(uint32_t *)];
-   char new_l_[PADL_(void *)]; void * new; char new_r_[PADR_(void *)];
+   char new_l_[PADL_(const void *)]; const void * new; char 
new_r_[PADR_(const void *)];
char newlen_l_[PADL_(uint32_t)]; uint32_t newlen; char 
newlen_r_[PADR_(uint32_t)];
 };
 struct freebsd32_futimes_args {
@@ -728,7 +728,7 @@ struct freebsd32_cpuset_setdomain_args {
char mask_l_[PADL_(domainset_t *)]; domainset_t * mask; char 
mask_r_[PADR_(domainset_t *)];
char policy_l_[PADL_(int)]; int policy; char policy_r_[PADR_(int)];
 };
-#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__))
+#if !defined(PAD64_REQUIRED) && !defined(__amd64__)
 #define PAD64_REQUIRED
 #endif
 intfreebsd32_wait4(struct thread *, struct freebsd32_wait4_args *);
@@ -868,7 +868,7 @@ int freebsd32_cpuset_setdomain(struct thread *, struct
 
 #ifdef COMPAT_43
 
-#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__))
+#if !defined(PAD64_REQUIRED) && !defined(__amd64__)
 #define PAD64_REQUIRED
 #endif
 struct ofreebsd32_lseek_args {
@@ -963,7 +963,7 @@ int ofreebsd32_getdirentries(struct thread *, struct o
 
 #ifdef COMPAT_FREEBSD4
 
-#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__))
+#if !defined(PAD64_REQUIRED) && !defined(__amd64__)
 #define PAD64_REQUIRED
 #endif
 struct freebsd4_freebsd32_getfsstat_args {
@@ -1029,7 +1029,7 @@ int   freebsd4_freebsd32_sigreturn(struct thread *, 
stru
 
 #ifdef COMPAT_FREEBSD6
 
-#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__))
+#if !defined(PAD64_REQUIRED) && !defined(__amd64__)
 #define PAD64_REQUIRED
 #endif
 struct freebsd6_freebsd32_pread_args {
@@ -1119,7 +1119,7 @@ int   freebsd6_freebsd32_lio_listio(struct thread *, 
str
 
 #ifdef COMPAT_FREEBSD7
 
-#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__))
+#if !defined(PAD64_REQUIRED) && !defined(__amd64__)
 #define PAD64_REQUIRED
 #endif
 struct freebsd7_freebsd32_semctl_args {
@@ -1162,7 +1162,7 @@ int   freebsd7_freebsd32_shmctl(struct thread *, 
struct 
 
 #ifdef COMPAT_FREEBSD10
 
-#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__))
+#if !defined(PAD64_REQUIRED) && !defined(__amd64__)
 #define PAD64_REQUIRED
 #endif
 #ifdef PAD64_REQUIRED
@@ -1187,7 +1187,7 @@ int   freebsd10_freebsd32_pipe(struct thread *, 
struct f
 
 #ifdef COMPAT_FREEBSD11
 
-#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__))
+#if !defined(PAD64_REQUIRED) && !defined(__amd64__)
 #define PAD64_REQUIRED
 #endif
 struct freebsd11_freebsd32_stat_args {

Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c
==
--- head/sys/compat/freebsd32/freebsd32_syscalls.c  Sun Jan 13 00:37:31 
2019(r342979)
+++ head/sys/compat/freebsd32/freebsd32_syscalls.c  Sun Jan 13 00:38:55 
2019(r342980)
@@ -6,7 +6,7 @@
  */
 
 const char *freebsd32_syscallnames[] = {
-#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__))
+#if !defined(PAD64_REQUIRED) && !defined(__amd64__)
 #define PAD64_REQUIRED
 #endif
"syscall",  /* 0 = syscall */

Modified: head/sys/compat/freebsd32/freebsd32_sysent.c
==
--- head/sys/compat/freebsd32/freebsd32_sysent.cSun Jan 13 00:37:31 
2019(r342979)
+++ head/sys/compat/freebsd32/freebsd32_sysent.cSun Jan 13 00:38:55 
2019(r342980)
@@ -53,7 +53,7 @@
 
 /* The casts are bogus but will do for now. */
 struct sysent freebsd32_sysent[] = {
-#if 

svn commit: r342979 - head/sys/compat/freebsd32

2019-01-12 Thread Olivier Houchard
Author: cognet
Date: Sun Jan 13 00:37:31 2019
New Revision: 342979
URL: https://svnweb.freebsd.org/changeset/base/342979

Log:
  amd64 is the only arch that doesn't require padding for 32bits syscalls, so
  instead of listing every arch thar requires it, just exclude amd64.

Modified:
  head/sys/compat/freebsd32/syscalls.master

Modified: head/sys/compat/freebsd32/syscalls.master
==
--- head/sys/compat/freebsd32/syscalls.master   Sun Jan 13 00:19:15 2019
(r342978)
+++ head/sys/compat/freebsd32/syscalls.master   Sun Jan 13 00:37:31 2019
(r342979)
@@ -54,7 +54,7 @@
 #include 
 #include 
 
-#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__))
+#if !defined(PAD64_REQUIRED) && !defined(__amd64__)
 #define PAD64_REQUIRED
 #endif
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r342978 - head/sys/kern

2019-01-12 Thread Olivier Houchard
Author: cognet
Date: Sun Jan 13 00:19:15 2019
New Revision: 342978
URL: https://svnweb.freebsd.org/changeset/base/342978

Log:
  Instead of using an incomplete list of platforms that uses 64bits time_t
  in 32bits mode, special case amd64, as i386 is the only arch that still
  uses 32bits time_t.

Modified:
  head/sys/kern/kern_tc.c

Modified: head/sys/kern/kern_tc.c
==
--- head/sys/kern/kern_tc.c Sat Jan 12 22:36:33 2019(r342977)
+++ head/sys/kern/kern_tc.c Sun Jan 13 00:19:15 2019(r342978)
@@ -145,7 +145,8 @@ sysctl_kern_boottime(SYSCTL_HANDLER_ARGS)
 
getboottime();
 
-#ifndef __mips__
+/* i386 is the only arch which uses a 32bits time_t */
+#ifdef __amd64__
 #ifdef SCTL_MASK32
int tv[2];
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r337533 - in head/sys/contrib/ck: include/gcc/ppc include/spinlock src

2018-08-09 Thread Olivier Houchard
Author: cognet
Date: Thu Aug  9 12:11:49 2018
New Revision: 337533
URL: https://svnweb.freebsd.org/changeset/base/337533

Log:
  Import CK as of commit 08813496570879fbcc2adcdd9ddc0a054361bfde, mostly
  to avoid using lwsync on ppc32.

Modified:
  head/sys/contrib/ck/include/gcc/ppc/ck_pr.h
  head/sys/contrib/ck/include/spinlock/hclh.h
  head/sys/contrib/ck/src/ck_barrier_combining.c
Directory Properties:
  head/sys/contrib/ck/   (props changed)

Modified: head/sys/contrib/ck/include/gcc/ppc/ck_pr.h
==
--- head/sys/contrib/ck/include/gcc/ppc/ck_pr.h Thu Aug  9 12:09:35 2018
(r337532)
+++ head/sys/contrib/ck/include/gcc/ppc/ck_pr.h Thu Aug  9 12:11:49 2018
(r337533)
@@ -67,21 +67,29 @@ ck_pr_stall(void)
__asm__ __volatile__(I ::: "memory");   \
}
 
-CK_PR_FENCE(atomic, "lwsync")
-CK_PR_FENCE(atomic_store, "lwsync")
+#ifdef CK_MD_PPC32_LWSYNC
+#define CK_PR_LWSYNCOP "lwsync"
+#else /* CK_MD_PPC32_LWSYNC_DISABLE */
+#define CK_PR_LWSYNCOP "sync"
+#endif
+
+CK_PR_FENCE(atomic, CK_PR_LWSYNCOP)
+CK_PR_FENCE(atomic_store, CK_PR_LWSYNCOP)
 CK_PR_FENCE(atomic_load, "sync")
-CK_PR_FENCE(store_atomic, "lwsync")
-CK_PR_FENCE(load_atomic, "lwsync")
-CK_PR_FENCE(store, "lwsync")
+CK_PR_FENCE(store_atomic, CK_PR_LWSYNCOP)
+CK_PR_FENCE(load_atomic, CK_PR_LWSYNCOP)
+CK_PR_FENCE(store, CK_PR_LWSYNCOP)
 CK_PR_FENCE(store_load, "sync")
-CK_PR_FENCE(load, "lwsync")
-CK_PR_FENCE(load_store, "lwsync")
+CK_PR_FENCE(load, CK_PR_LWSYNCOP)
+CK_PR_FENCE(load_store, CK_PR_LWSYNCOP)
 CK_PR_FENCE(memory, "sync")
-CK_PR_FENCE(acquire, "lwsync")
-CK_PR_FENCE(release, "lwsync")
-CK_PR_FENCE(acqrel, "lwsync")
-CK_PR_FENCE(lock, "lwsync")
-CK_PR_FENCE(unlock, "lwsync")
+CK_PR_FENCE(acquire, CK_PR_LWSYNCOP)
+CK_PR_FENCE(release, CK_PR_LWSYNCOP)
+CK_PR_FENCE(acqrel, CK_PR_LWSYNCOP)
+CK_PR_FENCE(lock, CK_PR_LWSYNCOP)
+CK_PR_FENCE(unlock, CK_PR_LWSYNCOP)
+
+#undef CK_PR_LWSYNCOP
 
 #undef CK_PR_FENCE
 

Modified: head/sys/contrib/ck/include/spinlock/hclh.h
==
--- head/sys/contrib/ck/include/spinlock/hclh.h Thu Aug  9 12:09:35 2018
(r337532)
+++ head/sys/contrib/ck/include/spinlock/hclh.h Thu Aug  9 12:11:49 2018
(r337533)
@@ -81,6 +81,8 @@ ck_spinlock_hclh_lock(struct ck_spinlock_hclh **glob_q
thread->wait = true;
thread->splice = false;
thread->cluster_id = (*local_queue)->cluster_id;
+   /* Make sure previous->previous doesn't appear to be NULL */
+   thread->previous = *local_queue;
 
/* Serialize with respect to update of local queue. */
ck_pr_fence_store_atomic();
@@ -91,13 +93,15 @@ ck_spinlock_hclh_lock(struct ck_spinlock_hclh **glob_q
 
/* Wait until previous thread from the local queue is done with lock. */
ck_pr_fence_load();
-   if (previous->previous != NULL &&
-   previous->cluster_id == thread->cluster_id) {
-   while (ck_pr_load_uint(>wait) == true)
+   if (previous->previous != NULL) {
+   while (ck_pr_load_uint(>wait) == true &&
+   ck_pr_load_int(>cluster_id) == 
thread->cluster_id &&
+   ck_pr_load_uint(>splice) == false)
ck_pr_stall();
 
/* We're head of the global queue, we're done */
-   if (ck_pr_load_uint(>splice) == false)
+   if (ck_pr_load_int(>cluster_id) == thread->cluster_id 
&&
+   ck_pr_load_uint(>splice) == false)
return;
}
 

Modified: head/sys/contrib/ck/src/ck_barrier_combining.c
==
--- head/sys/contrib/ck/src/ck_barrier_combining.c  Thu Aug  9 12:09:35 
2018(r337532)
+++ head/sys/contrib/ck/src/ck_barrier_combining.c  Thu Aug  9 12:11:49 
2018(r337533)
@@ -35,7 +35,7 @@ struct ck_barrier_combining_queue {
struct ck_barrier_combining_group *tail;
 };
 
-CK_CC_INLINE static struct ck_barrier_combining_group *
+static struct ck_barrier_combining_group *
 ck_barrier_combining_queue_dequeue(struct ck_barrier_combining_queue *queue)
 {
struct ck_barrier_combining_group *front = NULL;
@@ -48,7 +48,7 @@ ck_barrier_combining_queue_dequeue(struct ck_barrier_c
return front;
 }
 
-CK_CC_INLINE static void
+static void
 ck_barrier_combining_insert(struct ck_barrier_combining_group *parent,
 struct ck_barrier_combining_group *tnode,
 struct ck_barrier_combining_group **child)
@@ -72,7 +72,7 @@ ck_barrier_combining_insert(struct ck_barrier_combinin
  * into the barrier's tree. We use a queue to implement this
  * traversal.
  */
-CK_CC_INLINE static void
+static void
 ck_barrier_combining_queue_enqueue(struct ck_barrier_combining_queue *queue,
 struct ck_barrier_combining_group *node_value)
 {
@@ -185,10 +185,10 @@ 

svn commit: r337532 - vendor-sys/ck/20180809

2018-08-09 Thread Olivier Houchard
Author: cognet
Date: Thu Aug  9 12:09:35 2018
New Revision: 337532
URL: https://svnweb.freebsd.org/changeset/base/337532

Log:
  Tag CK after import of commit 08813496570879fbcc2adcdd9ddc0a054361bfde

Added:
  vendor-sys/ck/20180809/
 - copied from r337531, vendor-sys/ck/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r337531 - in vendor-sys/ck/dist: include/gcc/ppc include/spinlock src

2018-08-09 Thread Olivier Houchard
Author: cognet
Date: Thu Aug  9 12:07:37 2018
New Revision: 337531
URL: https://svnweb.freebsd.org/changeset/base/337531

Log:
  Import CK as of commit 08813496570879fbcc2adcdd9ddc0a054361bfde, mostly
  to avoid using lwsync on ppc32.

Modified:
  vendor-sys/ck/dist/include/gcc/ppc/ck_pr.h
  vendor-sys/ck/dist/include/spinlock/hclh.h
  vendor-sys/ck/dist/src/ck_barrier_combining.c

Modified: vendor-sys/ck/dist/include/gcc/ppc/ck_pr.h
==
--- vendor-sys/ck/dist/include/gcc/ppc/ck_pr.h  Thu Aug  9 11:46:12 2018
(r337530)
+++ vendor-sys/ck/dist/include/gcc/ppc/ck_pr.h  Thu Aug  9 12:07:37 2018
(r337531)
@@ -67,21 +67,29 @@ ck_pr_stall(void)
__asm__ __volatile__(I ::: "memory");   \
}
 
-CK_PR_FENCE(atomic, "lwsync")
-CK_PR_FENCE(atomic_store, "lwsync")
+#ifdef CK_MD_PPC32_LWSYNC
+#define CK_PR_LWSYNCOP "lwsync"
+#else /* CK_MD_PPC32_LWSYNC_DISABLE */
+#define CK_PR_LWSYNCOP "sync"
+#endif
+
+CK_PR_FENCE(atomic, CK_PR_LWSYNCOP)
+CK_PR_FENCE(atomic_store, CK_PR_LWSYNCOP)
 CK_PR_FENCE(atomic_load, "sync")
-CK_PR_FENCE(store_atomic, "lwsync")
-CK_PR_FENCE(load_atomic, "lwsync")
-CK_PR_FENCE(store, "lwsync")
+CK_PR_FENCE(store_atomic, CK_PR_LWSYNCOP)
+CK_PR_FENCE(load_atomic, CK_PR_LWSYNCOP)
+CK_PR_FENCE(store, CK_PR_LWSYNCOP)
 CK_PR_FENCE(store_load, "sync")
-CK_PR_FENCE(load, "lwsync")
-CK_PR_FENCE(load_store, "lwsync")
+CK_PR_FENCE(load, CK_PR_LWSYNCOP)
+CK_PR_FENCE(load_store, CK_PR_LWSYNCOP)
 CK_PR_FENCE(memory, "sync")
-CK_PR_FENCE(acquire, "lwsync")
-CK_PR_FENCE(release, "lwsync")
-CK_PR_FENCE(acqrel, "lwsync")
-CK_PR_FENCE(lock, "lwsync")
-CK_PR_FENCE(unlock, "lwsync")
+CK_PR_FENCE(acquire, CK_PR_LWSYNCOP)
+CK_PR_FENCE(release, CK_PR_LWSYNCOP)
+CK_PR_FENCE(acqrel, CK_PR_LWSYNCOP)
+CK_PR_FENCE(lock, CK_PR_LWSYNCOP)
+CK_PR_FENCE(unlock, CK_PR_LWSYNCOP)
+
+#undef CK_PR_LWSYNCOP
 
 #undef CK_PR_FENCE
 

Modified: vendor-sys/ck/dist/include/spinlock/hclh.h
==
--- vendor-sys/ck/dist/include/spinlock/hclh.h  Thu Aug  9 11:46:12 2018
(r337530)
+++ vendor-sys/ck/dist/include/spinlock/hclh.h  Thu Aug  9 12:07:37 2018
(r337531)
@@ -81,6 +81,8 @@ ck_spinlock_hclh_lock(struct ck_spinlock_hclh **glob_q
thread->wait = true;
thread->splice = false;
thread->cluster_id = (*local_queue)->cluster_id;
+   /* Make sure previous->previous doesn't appear to be NULL */
+   thread->previous = *local_queue;
 
/* Serialize with respect to update of local queue. */
ck_pr_fence_store_atomic();
@@ -91,13 +93,15 @@ ck_spinlock_hclh_lock(struct ck_spinlock_hclh **glob_q
 
/* Wait until previous thread from the local queue is done with lock. */
ck_pr_fence_load();
-   if (previous->previous != NULL &&
-   previous->cluster_id == thread->cluster_id) {
-   while (ck_pr_load_uint(>wait) == true)
+   if (previous->previous != NULL) {
+   while (ck_pr_load_uint(>wait) == true &&
+   ck_pr_load_int(>cluster_id) == 
thread->cluster_id &&
+   ck_pr_load_uint(>splice) == false)
ck_pr_stall();
 
/* We're head of the global queue, we're done */
-   if (ck_pr_load_uint(>splice) == false)
+   if (ck_pr_load_int(>cluster_id) == thread->cluster_id 
&&
+   ck_pr_load_uint(>splice) == false)
return;
}
 

Modified: vendor-sys/ck/dist/src/ck_barrier_combining.c
==
--- vendor-sys/ck/dist/src/ck_barrier_combining.c   Thu Aug  9 11:46:12 
2018(r337530)
+++ vendor-sys/ck/dist/src/ck_barrier_combining.c   Thu Aug  9 12:07:37 
2018(r337531)
@@ -35,7 +35,7 @@ struct ck_barrier_combining_queue {
struct ck_barrier_combining_group *tail;
 };
 
-CK_CC_INLINE static struct ck_barrier_combining_group *
+static struct ck_barrier_combining_group *
 ck_barrier_combining_queue_dequeue(struct ck_barrier_combining_queue *queue)
 {
struct ck_barrier_combining_group *front = NULL;
@@ -48,7 +48,7 @@ ck_barrier_combining_queue_dequeue(struct ck_barrier_c
return front;
 }
 
-CK_CC_INLINE static void
+static void
 ck_barrier_combining_insert(struct ck_barrier_combining_group *parent,
 struct ck_barrier_combining_group *tnode,
 struct ck_barrier_combining_group **child)
@@ -72,7 +72,7 @@ ck_barrier_combining_insert(struct ck_barrier_combinin
  * into the barrier's tree. We use a queue to implement this
  * traversal.
  */
-CK_CC_INLINE static void
+static void
 ck_barrier_combining_queue_enqueue(struct ck_barrier_combining_queue *queue,
 struct ck_barrier_combining_group *node_value)
 {
@@ -185,10 +185,10 @@ ck_barrier_combining_aux(struct ck_barrier_combining *

Re: svn commit: r335068 - in head: share/man/man9 sys/amd64/amd64 sys/i386/i386 sys/kern sys/net sys/sys sys/vm

2018-06-14 Thread Olivier Houchard
Hi,

On Fri, Jun 15, 2018 at 12:23:36AM +0200, Emmanuel Vadot wrote:
> 
>  Hi Jonathan,
> 
[...]

>  This brake module loading on armv7 and arm64
>  kevans log on armv7 :
> https://gist.github.com/kevans91/d0ffcd6c94a0e4cdfdc5433612fce2e8
>  mine on arm64 : http://dpaste.com/3VVBZDV
> 
>  Do you have any idea what could cause that ? Is any MD stuff is
> missing for those arches ?
> 
>  Thanks,
> 

I think I fixed it with r335182.
Jonathan probably missed it because modules are differnt on amd64 (and
mips), and the code that handles those are different, and doesn't use
malloc().

Regards,

Olivier
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335182 - head/sys/kern

2018-06-14 Thread Olivier Houchard
Author: cognet
Date: Thu Jun 14 23:10:10 2018
New Revision: 335182
URL: https://svnweb.freebsd.org/changeset/base/335182

Log:
  Use M_EXEC when calling malloc() to allocate the memory to store the module,
  as it'll contain executable code.

Modified:
  head/sys/kern/link_elf.c

Modified: head/sys/kern/link_elf.c
==
--- head/sys/kern/link_elf.cThu Jun 14 22:31:30 2018(r335181)
+++ head/sys/kern/link_elf.cThu Jun 14 23:10:10 2018(r335182)
@@ -945,7 +945,7 @@ link_elf_load_file(linker_class_t cls, const char* fil
goto out;
}
 #else
-   ef->address = malloc(mapsize, M_LINKER, M_WAITOK);
+   ef->address = malloc(mapsize, M_LINKER, M_EXEC | M_WAITOK);
 #endif
mapbase = ef->address;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334189 - head/sys/contrib/ck/include

2018-05-24 Thread Olivier Houchard
Author: cognet
Date: Thu May 24 21:38:18 2018
New Revision: 334189
URL: https://svnweb.freebsd.org/changeset/base/334189

Log:
  Import CK as of commit 0f017230ccc86929f56bf44ef2dca93d7df8076b.
  This brings us the renaming of fields in ck_queue, so that our own
  LIST/SLIST/TAILQ/etc won't accidentally work with them.

Modified:
  head/sys/contrib/ck/include/ck_queue.h
Directory Properties:
  head/sys/contrib/ck/   (props changed)

Modified: head/sys/contrib/ck/include/ck_queue.h
==
--- head/sys/contrib/ck/include/ck_queue.h  Thu May 24 21:37:04 2018
(r334188)
+++ head/sys/contrib/ck/include/ck_queue.h  Thu May 24 21:38:18 2018
(r334189)
@@ -125,7 +125,7 @@
  */
 #defineCK_SLIST_HEAD(name, type)   
\
 struct name {  
\
-   struct type *slh_first; /* first element */ 
\
+   struct type *cslh_first;/* first element */ 
\
 }
 
 #defineCK_SLIST_HEAD_INITIALIZER(head) 
\
@@ -133,20 +133,20 @@ struct name { 
\
 
 #defineCK_SLIST_ENTRY(type)
\
 struct {   
\
-   struct type *sle_next;  /* next element */  
\
+   struct type *csle_next; /* next element */  
\
 }
 
 /*
  * Singly-linked List functions.
  */
 #defineCK_SLIST_EMPTY(head)
\
-   (ck_pr_load_ptr(&(head)->slh_first) == NULL)
+   (ck_pr_load_ptr(&(head)->cslh_first) == NULL)
 
 #defineCK_SLIST_FIRST(head)
\
-   (ck_pr_load_ptr(&(head)->slh_first))
+   (ck_pr_load_ptr(&(head)->cslh_first))
 
 #defineCK_SLIST_NEXT(elm, field)   
\
-   ck_pr_load_ptr(&((elm)->field.sle_next))
+   ck_pr_load_ptr(&((elm)->field.csle_next))
 
 #defineCK_SLIST_FOREACH(var, head, field)  
\
for ((var) = CK_SLIST_FIRST((head));
\
@@ -159,59 +159,59 @@ struct {  
\
(var) = (tvar))
 
 #defineCK_SLIST_FOREACH_PREVPTR(var, varp, head, field)
\
-   for ((varp) = &(head)->slh_first;   
\
+   for ((varp) = &(head)->cslh_first;  
\
((var) = ck_pr_load_ptr(varp)) != NULL && (ck_pr_fence_load(), 1);  
\
-   (varp) = &(var)->field.sle_next)
+   (varp) = &(var)->field.csle_next)
 
 #defineCK_SLIST_INIT(head) do {
\
-   ck_pr_store_ptr(&(head)->slh_first, NULL);  
\
+   ck_pr_store_ptr(&(head)->cslh_first, NULL); 
\
ck_pr_fence_store();
\
 } while (0)
 
 #defineCK_SLIST_INSERT_AFTER(a, b, field) do { 
\
-   (b)->field.sle_next = (a)->field.sle_next;  
\
+   (b)->field.csle_next = (a)->field.csle_next;
\
ck_pr_fence_store();
\
-   ck_pr_store_ptr(&(a)->field.sle_next, b);   
\
+   ck_pr_store_ptr(&(a)->field.csle_next, b);  
\
 } while (0)
 
 #defineCK_SLIST_INSERT_HEAD(head, elm, field) do { 
\
-   (elm)->field.sle_next = (head)->slh_first;  
\
+   (elm)->field.csle_next = (head)->cslh_first;
\
ck_pr_fence_store();
\
-   ck_pr_store_ptr(&(head)->slh_first, elm);   
\
+   ck_pr_store_ptr(&(head)->cslh_first, elm);  
\
 } while (0)
 
 #define CK_SLIST_REMOVE_AFTER(elm, field) do { 
\
-   ck_pr_store_ptr(&(elm)->field.sle_next, 
\
-   (elm)->field.sle_next->field.sle_next); 
\
+   ck_pr_store_ptr(&(elm)->field.csle_next,
\
+   (elm)->field.csle_next->field.csle_next);   
\
 } while (0)
 
 #defineCK_SLIST_REMOVE(head, elm, type, field) do {
\
-   if ((head)->slh_first == (elm)) {   

svn commit: r334188 - vendor-sys/ck/20180524

2018-05-24 Thread Olivier Houchard
Author: cognet
Date: Thu May 24 21:37:04 2018
New Revision: 334188
URL: https://svnweb.freebsd.org/changeset/base/334188

Log:
  Tag import of CK as of commit 0f017230ccc86929f56bf44ef2dca93d7df8076b.

Added:
  vendor-sys/ck/20180524/
 - copied from r334187, vendor-sys/ck/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334187 - vendor-sys/ck/dist/include

2018-05-24 Thread Olivier Houchard
Author: cognet
Date: Thu May 24 21:35:52 2018
New Revision: 334187
URL: https://svnweb.freebsd.org/changeset/base/334187

Log:
  Import CK as of commit 0f017230ccc86929f56bf44ef2dca93d7df8076b.
  This brings us the renaming of fields in ck_queue, so that our own
  LIST/SLIST/TAILQ/etc won't accidentally work with them.

Modified:
  vendor-sys/ck/dist/include/ck_queue.h

Modified: vendor-sys/ck/dist/include/ck_queue.h
==
--- vendor-sys/ck/dist/include/ck_queue.h   Thu May 24 21:22:03 2018
(r334186)
+++ vendor-sys/ck/dist/include/ck_queue.h   Thu May 24 21:35:52 2018
(r334187)
@@ -125,7 +125,7 @@
  */
 #defineCK_SLIST_HEAD(name, type)   
\
 struct name {  
\
-   struct type *slh_first; /* first element */ 
\
+   struct type *cslh_first;/* first element */ 
\
 }
 
 #defineCK_SLIST_HEAD_INITIALIZER(head) 
\
@@ -133,20 +133,20 @@ struct name { 
\
 
 #defineCK_SLIST_ENTRY(type)
\
 struct {   
\
-   struct type *sle_next;  /* next element */  
\
+   struct type *csle_next; /* next element */  
\
 }
 
 /*
  * Singly-linked List functions.
  */
 #defineCK_SLIST_EMPTY(head)
\
-   (ck_pr_load_ptr(&(head)->slh_first) == NULL)
+   (ck_pr_load_ptr(&(head)->cslh_first) == NULL)
 
 #defineCK_SLIST_FIRST(head)
\
-   (ck_pr_load_ptr(&(head)->slh_first))
+   (ck_pr_load_ptr(&(head)->cslh_first))
 
 #defineCK_SLIST_NEXT(elm, field)   
\
-   ck_pr_load_ptr(&((elm)->field.sle_next))
+   ck_pr_load_ptr(&((elm)->field.csle_next))
 
 #defineCK_SLIST_FOREACH(var, head, field)  
\
for ((var) = CK_SLIST_FIRST((head));
\
@@ -159,59 +159,59 @@ struct {  
\
(var) = (tvar))
 
 #defineCK_SLIST_FOREACH_PREVPTR(var, varp, head, field)
\
-   for ((varp) = &(head)->slh_first;   
\
+   for ((varp) = &(head)->cslh_first;  
\
((var) = ck_pr_load_ptr(varp)) != NULL && (ck_pr_fence_load(), 1);  
\
-   (varp) = &(var)->field.sle_next)
+   (varp) = &(var)->field.csle_next)
 
 #defineCK_SLIST_INIT(head) do {
\
-   ck_pr_store_ptr(&(head)->slh_first, NULL);  
\
+   ck_pr_store_ptr(&(head)->cslh_first, NULL); 
\
ck_pr_fence_store();
\
 } while (0)
 
 #defineCK_SLIST_INSERT_AFTER(a, b, field) do { 
\
-   (b)->field.sle_next = (a)->field.sle_next;  
\
+   (b)->field.csle_next = (a)->field.csle_next;
\
ck_pr_fence_store();
\
-   ck_pr_store_ptr(&(a)->field.sle_next, b);   
\
+   ck_pr_store_ptr(&(a)->field.csle_next, b);  
\
 } while (0)
 
 #defineCK_SLIST_INSERT_HEAD(head, elm, field) do { 
\
-   (elm)->field.sle_next = (head)->slh_first;  
\
+   (elm)->field.csle_next = (head)->cslh_first;
\
ck_pr_fence_store();
\
-   ck_pr_store_ptr(&(head)->slh_first, elm);   
\
+   ck_pr_store_ptr(&(head)->cslh_first, elm);  
\
 } while (0)
 
 #define CK_SLIST_REMOVE_AFTER(elm, field) do { 
\
-   ck_pr_store_ptr(&(elm)->field.sle_next, 
\
-   (elm)->field.sle_next->field.sle_next); 
\
+   ck_pr_store_ptr(&(elm)->field.csle_next,
\
+   (elm)->field.csle_next->field.csle_next);   
\
 } while (0)
 
 #defineCK_SLIST_REMOVE(head, elm, type, field) do {
\
-   if ((head)->slh_first == (elm)) {   
\
+   if 

svn commit: r333791 - head/sys/arm64/arm64

2018-05-18 Thread Olivier Houchard
Author: cognet
Date: Fri May 18 13:28:02 2018
New Revision: 333791
URL: https://svnweb.freebsd.org/changeset/base/333791

Log:
  Instead of ignoring the VFP registers, set the dumppcb's pcb_fpusaved
  field, so that they are saved, as they may be used in the kernel, in the
  EFI and the crypto code.
  
  Reviewed by:  andrew

Modified:
  head/sys/arm64/arm64/vfp.c

Modified: head/sys/arm64/arm64/vfp.c
==
--- head/sys/arm64/arm64/vfp.c  Fri May 18 13:03:04 2018(r333790)
+++ head/sys/arm64/arm64/vfp.c  Fri May 18 13:28:02 2018(r333791)
@@ -172,12 +172,11 @@ vfp_save_state(struct thread *td, struct pcb *pcb)
 
/* 
 * savectx() will be called on panic with dumppcb as an argument,
-* dumppcb doesn't have pcb_fpusaved set so don't make any attempt
-* to store the VFP registers in it, we probably don't care much
-* at that point, anyway.
+* dumppcb doesn't have pcb_fpusaved set, so set it to save
+* the VFP registers.
 */
if (pcb->pcb_fpusaved == NULL)
-   return;
+   pcb->pcb_fpusaved = >pcb_fpustate;
 
if (td == NULL)
td = curthread;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r333772 - head/sys/arm64/arm64

2018-05-17 Thread Olivier Houchard
Author: cognet
Date: Thu May 17 22:40:22 2018
New Revision: 333772
URL: https://svnweb.freebsd.org/changeset/base/333772

Log:
  In pmap_get_tables(), check that the L2 is indeed a table before attempting
  to get the l3.

Modified:
  head/sys/arm64/arm64/pmap.c

Modified: head/sys/arm64/arm64/pmap.c
==
--- head/sys/arm64/arm64/pmap.c Thu May 17 22:38:16 2018(r333771)
+++ head/sys/arm64/arm64/pmap.c Thu May 17 22:40:22 2018(r333772)
@@ -487,6 +487,9 @@ pmap_get_tables(pmap_t pmap, vm_offset_t va, pd_entry_
return (true);
}
 
+   if ((pmap_load(l2p) & ATTR_DESCR_MASK) != L2_TABLE)
+   return (false);
+
*l3 = pmap_l2_to_l3(l2p, va);
 
return (true);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r333771 - head/sys/arm64/arm64

2018-05-17 Thread Olivier Houchard
Author: cognet
Date: Thu May 17 22:38:16 2018
New Revision: 333771
URL: https://svnweb.freebsd.org/changeset/base/333771

Log:
  In vfp_save_state(), don't bother trying to save the VFP registers if the
  provided PCB doesn't have a pcb_fpusaved. All PCBs associated to a thread
  should have one, but the dumppcb used when panic'ing doesn't.

Modified:
  head/sys/arm64/arm64/vfp.c

Modified: head/sys/arm64/arm64/vfp.c
==
--- head/sys/arm64/arm64/vfp.c  Thu May 17 21:49:34 2018(r333770)
+++ head/sys/arm64/arm64/vfp.c  Thu May 17 22:38:16 2018(r333771)
@@ -170,6 +170,15 @@ vfp_save_state(struct thread *td, struct pcb *pcb)
KASSERT(pcb != NULL, ("NULL vfp pcb"));
KASSERT(td == NULL || td->td_pcb == pcb, ("Invalid vfp pcb"));
 
+   /* 
+* savectx() will be called on panic with dumppcb as an argument,
+* dumppcb doesn't have pcb_fpusaved set so don't make any attempt
+* to store the VFP registers in it, we probably don't care much
+* at that point, anyway.
+*/
+   if (pcb->pcb_fpusaved == NULL)
+   return;
+
if (td == NULL)
td = curthread;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r333764 - head/sys/contrib/ck

2018-05-17 Thread Olivier Houchard
Author: cognet
Date: Thu May 17 21:03:36 2018
New Revision: 333764
URL: https://svnweb.freebsd.org/changeset/base/333764

Log:
  Import CK as of commit deca119d14bfffd440770eb67cbdbeaf7b57eb7b.
  This is mostly a noop, for mergeinfo purpose, because the relevant changes
  were committed directly.

Modified:
Directory Properties:
  head/sys/contrib/ck/   (props changed)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r333763 - vendor-sys/ck/20180517

2018-05-17 Thread Olivier Houchard
Author: cognet
Date: Thu May 17 20:59:18 2018
New Revision: 333763
URL: https://svnweb.freebsd.org/changeset/base/333763

Log:
  Tag import as of commit deca119d14bfffd440770eb67cbdbeaf7b57eb7b.

Added:
  vendor-sys/ck/20180517/
 - copied from r333762, vendor-sys/ck/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r333762 - in vendor-sys/ck/dist: include src

2018-05-17 Thread Olivier Houchard
Author: cognet
Date: Thu May 17 20:57:30 2018
New Revision: 333762
URL: https://svnweb.freebsd.org/changeset/base/333762

Log:
  Import CK as of commit deca119d14bfffd440770eb67cbdbeaf7b57eb7b
  
  This brings us ck_epoch_deferred, which is used by the new facility
  epoch(9).

Modified:
  vendor-sys/ck/dist/include/ck_epoch.h
  vendor-sys/ck/dist/src/ck_epoch.c

Modified: vendor-sys/ck/dist/include/ck_epoch.h
==
--- vendor-sys/ck/dist/include/ck_epoch.h   Thu May 17 19:57:07 2018
(r333761)
+++ vendor-sys/ck/dist/include/ck_epoch.h   Thu May 17 20:57:30 2018
(r333762)
@@ -266,6 +266,7 @@ void ck_epoch_register(ck_epoch_t *, ck_epoch_record_t
 void ck_epoch_unregister(ck_epoch_record_t *);
 
 bool ck_epoch_poll(ck_epoch_record_t *);
+bool ck_epoch_poll_deferred(struct ck_epoch_record *record, ck_stack_t 
*deferred);
 void ck_epoch_synchronize(ck_epoch_record_t *);
 void ck_epoch_synchronize_wait(ck_epoch_t *, ck_epoch_wait_cb_t *, void *);
 void ck_epoch_barrier(ck_epoch_record_t *);

Modified: vendor-sys/ck/dist/src/ck_epoch.c
==
--- vendor-sys/ck/dist/src/ck_epoch.c   Thu May 17 19:57:07 2018
(r333761)
+++ vendor-sys/ck/dist/src/ck_epoch.c   Thu May 17 20:57:30 2018
(r333762)
@@ -349,7 +349,7 @@ ck_epoch_scan(struct ck_epoch *global,
 }
 
 static void
-ck_epoch_dispatch(struct ck_epoch_record *record, unsigned int e)
+ck_epoch_dispatch(struct ck_epoch_record *record, unsigned int e, ck_stack_t 
*deferred)
 {
unsigned int epoch = e & (CK_EPOCH_LENGTH - 1);
ck_stack_entry_t *head, *next, *cursor;
@@ -362,7 +362,10 @@ ck_epoch_dispatch(struct ck_epoch_record *record, unsi
ck_epoch_entry_container(cursor);
 
next = CK_STACK_NEXT(cursor);
-   entry->function(entry);
+   if (deferred != NULL)
+   ck_stack_push_spnc(deferred, >stack_entry);
+   else
+   entry->function(entry);
i++;
}
 
@@ -390,7 +393,7 @@ ck_epoch_reclaim(struct ck_epoch_record *record)
unsigned int epoch;
 
for (epoch = 0; epoch < CK_EPOCH_LENGTH; epoch++)
-   ck_epoch_dispatch(record, epoch);
+   ck_epoch_dispatch(record, epoch, NULL);
 
return;
 }
@@ -551,7 +554,7 @@ ck_epoch_barrier_wait(struct ck_epoch_record *record, 
  * is far from ideal too.
  */
 bool
-ck_epoch_poll(struct ck_epoch_record *record)
+ck_epoch_poll_deferred(struct ck_epoch_record *record, ck_stack_t *deferred)
 {
bool active;
unsigned int epoch;
@@ -572,7 +575,7 @@ ck_epoch_poll(struct ck_epoch_record *record)
if (active == false) {
record->epoch = epoch;
for (epoch = 0; epoch < CK_EPOCH_LENGTH; epoch++)
-   ck_epoch_dispatch(record, epoch);
+   ck_epoch_dispatch(record, epoch, deferred);
 
return true;
}
@@ -580,6 +583,13 @@ ck_epoch_poll(struct ck_epoch_record *record)
/* If an active thread exists, rely on epoch observation. */
(void)ck_pr_cas_uint(>epoch, epoch, epoch + 1);
 
-   ck_epoch_dispatch(record, epoch + 1);
+   ck_epoch_dispatch(record, epoch + 1, deferred);
return true;
+}
+
+bool
+ck_epoch_poll(struct ck_epoch_record *record)
+{
+
+   return ck_epoch_poll_deferred(record, NULL);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r332391 - in stable/11/sys: contrib/ck contrib/ck/include contrib/ck/include/gcc contrib/ck/include/gcc/sparcv9 contrib/ck/include/gcc/x86 contrib/ck/include/gcc/x86_64 contrib/ck/inclu...

2018-04-10 Thread Olivier Houchard
Author: cognet
Date: Tue Apr 10 20:22:36 2018
New Revision: 332391
URL: https://svnweb.freebsd.org/changeset/base/332391

Log:
  MFC r329388, r331441 and r331898, to bring the -CURRENT ck version.
  r329388:
  Define CK_MD_TSO for the relevant arches (i386, amd64 and sparc64).
  Defaulting to CK_MD_RMO has the unfortunate side effect of generating
  memory barriers that are useless on those arches, and the even more
  unfortunate side effect of generating lfence/sfence/mfence on i386, even
  if older CPUs don't support it.
  This should fix the panic reported when using IPFW on a Pentium 3.
  Note that mfence and sfence might still be used in a few case, but that
  shouldn't happen in FreeBSD right now, and should be fixed upstream first.
  
  r331441:
  In __sync_bool_compare_and_swap(), return true if the returned value is the
  same as the expected one, not the desired one.
  
  r331898:
  Import CK as of commit b19ed4c6a56ec93215ab567ba18ba61bf1cfbac8
  It should fix ck_pr_[load|store]_ptr on mips and riscv, make sure no
  *fence instructions are used on i386, as older cpus don't support it, and
  make sure we don't rely on gcc builtins that can lead to calls to
  libatomic when linked with -O0.

Modified:
  stable/11/sys/contrib/ck/FREEBSD-Xlist
  stable/11/sys/contrib/ck/include/ck_cc.h
  stable/11/sys/contrib/ck/include/ck_hs.h
  stable/11/sys/contrib/ck/include/ck_md.h
  stable/11/sys/contrib/ck/include/ck_pr.h
  stable/11/sys/contrib/ck/include/ck_queue.h
  stable/11/sys/contrib/ck/include/ck_ring.h
  stable/11/sys/contrib/ck/include/gcc/ck_cc.h
  stable/11/sys/contrib/ck/include/gcc/ck_pr.h
  stable/11/sys/contrib/ck/include/gcc/sparcv9/ck_pr.h
  stable/11/sys/contrib/ck/include/gcc/x86/ck_pr.h
  stable/11/sys/contrib/ck/include/gcc/x86_64/ck_pr.h
  stable/11/sys/contrib/ck/include/spinlock/dec.h
  stable/11/sys/contrib/ck/src/ck_hs.c
  stable/11/sys/contrib/ck/src/ck_ht.c
  stable/11/sys/contrib/ck/src/ck_ht_hash.h
  stable/11/sys/contrib/ck/src/ck_internal.h
  stable/11/sys/contrib/ck/src/ck_rhs.c
  stable/11/sys/mips/mips/stdatomic.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/contrib/ck/FREEBSD-Xlist
==
--- stable/11/sys/contrib/ck/FREEBSD-Xlist  Tue Apr 10 19:49:04 2018
(r332390)
+++ stable/11/sys/contrib/ck/FREEBSD-Xlist  Tue Apr 10 20:22:36 2018
(r332391)
@@ -8,4 +8,5 @@
 */regressions
 */tools
 */include/ck_md.h.in
+*/include/freebsd/ck_md.h.in
 */src/Makefile.in

Modified: stable/11/sys/contrib/ck/include/ck_cc.h
==
--- stable/11/sys/contrib/ck/include/ck_cc.hTue Apr 10 19:49:04 2018
(r332390)
+++ stable/11/sys/contrib/ck/include/ck_cc.hTue Apr 10 20:22:36 2018
(r332391)
@@ -104,42 +104,36 @@
 #define CK_CC_TYPEOF(X, DEFAULT) (DEFAULT)
 #endif
 
+#define CK_F_CC_FFS_G(L, T)\
+CK_CC_INLINE static int\
+ck_cc_##L(T v) \
+{  \
+   unsigned int i; \
+   \
+   if (v == 0) \
+   return 0;   \
+   \
+   for (i = 1; (v & 1) == 0; i++, v >>= 1);\
+   return i;   \
+}
+
 #ifndef CK_F_CC_FFS
 #define CK_F_CC_FFS
-CK_CC_INLINE static int
-ck_cc_ffs(unsigned int x)
-{
-   unsigned int i;
+CK_F_CC_FFS_G(ffs, unsigned int)
+#endif /* CK_F_CC_FFS */
 
-   if (x == 0)
-   return 0;
+#ifndef CK_F_CC_FFSL
+#define CK_F_CC_FFSL
+CK_F_CC_FFS_G(ffsl, unsigned long)
+#endif /* CK_F_CC_FFSL */
 
-   for (i = 1; (x & 1) == 0; i++, x >>= 1);
+#ifndef CK_F_CC_FFSLL
+#define CK_F_CC_FFSLL
+CK_F_CC_FFS_G(ffsll, unsigned long long)
+#endif /* CK_F_CC_FFSLL */
 
-   return i;
-}
-#endif
+#undef CK_F_CC_FFS_G
 
-#ifndef CK_F_CC_CLZ
-#define CK_F_CC_CLZ
-#include 
-
-CK_CC_INLINE static int
-ck_cc_clz(unsigned int x)
-{
-   unsigned int count, i;
-
-   for (count = 0, i = sizeof(unsigned int) * CHAR_BIT; i > 0; count++) {
-   unsigned int bit = 1U << --i;
-
-   if (x & bit)
-   break;
-   }
-
-   return count;
-}
-#endif
-
 #ifndef CK_F_CC_CTZ
 #define CK_F_CC_CTZ
 CK_CC_INLINE static int
@@ -151,7 +145,6 @@ ck_cc_ctz(unsigned int x)
return 0;
 
for (i = 0; (x & 1) == 0; i++, x >>= 1);
-
return i;
 }
 #endif

Modified: stable/11/sys/contrib/ck/include/ck_hs.h
==
--- stable/11/sys/contrib/ck/include/ck_hs.hTue Apr 10 19:49:04 2018
(r332390)
+++ 

svn commit: r331898 - in head/sys/contrib/ck: . include include/gcc include/gcc/sparcv9 include/gcc/x86 include/gcc/x86_64 include/spinlock src

2018-04-02 Thread Olivier Houchard
Author: cognet
Date: Mon Apr  2 23:40:50 2018
New Revision: 331898
URL: https://svnweb.freebsd.org/changeset/base/331898

Log:
  Import CK as of commit b19ed4c6a56ec93215ab567ba18ba61bf1cfbac8
  It should fix ck_pr_[load|store]_ptr on mips and riscv, make sure no
  *fence instructions are used on i386, as older cpus don't support it, and
  make sure we don't rely on gcc builtins that can lead to calls to
  libatomic when linked with -O0.
  
  MFC after:1 week

Modified:
  head/sys/contrib/ck/FREEBSD-Xlist
  head/sys/contrib/ck/include/ck_cc.h
  head/sys/contrib/ck/include/ck_hs.h
  head/sys/contrib/ck/include/ck_md.h
  head/sys/contrib/ck/include/ck_pr.h
  head/sys/contrib/ck/include/ck_queue.h
  head/sys/contrib/ck/include/ck_ring.h
  head/sys/contrib/ck/include/gcc/ck_cc.h
  head/sys/contrib/ck/include/gcc/ck_pr.h
  head/sys/contrib/ck/include/gcc/sparcv9/ck_pr.h
  head/sys/contrib/ck/include/gcc/x86/ck_pr.h
  head/sys/contrib/ck/include/gcc/x86_64/ck_pr.h
  head/sys/contrib/ck/include/spinlock/dec.h
  head/sys/contrib/ck/src/ck_hs.c
  head/sys/contrib/ck/src/ck_ht.c
  head/sys/contrib/ck/src/ck_ht_hash.h
  head/sys/contrib/ck/src/ck_internal.h
  head/sys/contrib/ck/src/ck_rhs.c
Directory Properties:
  head/sys/contrib/ck/   (props changed)

Modified: head/sys/contrib/ck/FREEBSD-Xlist
==
--- head/sys/contrib/ck/FREEBSD-Xlist   Mon Apr  2 23:39:04 2018
(r331897)
+++ head/sys/contrib/ck/FREEBSD-Xlist   Mon Apr  2 23:40:50 2018
(r331898)
@@ -8,4 +8,5 @@
 */regressions
 */tools
 */include/ck_md.h.in
+*/include/freebsd/ck_md.h.in
 */src/Makefile.in

Modified: head/sys/contrib/ck/include/ck_cc.h
==
--- head/sys/contrib/ck/include/ck_cc.h Mon Apr  2 23:39:04 2018
(r331897)
+++ head/sys/contrib/ck/include/ck_cc.h Mon Apr  2 23:40:50 2018
(r331898)
@@ -104,42 +104,36 @@
 #define CK_CC_TYPEOF(X, DEFAULT) (DEFAULT)
 #endif
 
+#define CK_F_CC_FFS_G(L, T)\
+CK_CC_INLINE static int\
+ck_cc_##L(T v) \
+{  \
+   unsigned int i; \
+   \
+   if (v == 0) \
+   return 0;   \
+   \
+   for (i = 1; (v & 1) == 0; i++, v >>= 1);\
+   return i;   \
+}
+
 #ifndef CK_F_CC_FFS
 #define CK_F_CC_FFS
-CK_CC_INLINE static int
-ck_cc_ffs(unsigned int x)
-{
-   unsigned int i;
+CK_F_CC_FFS_G(ffs, unsigned int)
+#endif /* CK_F_CC_FFS */
 
-   if (x == 0)
-   return 0;
+#ifndef CK_F_CC_FFSL
+#define CK_F_CC_FFSL
+CK_F_CC_FFS_G(ffsl, unsigned long)
+#endif /* CK_F_CC_FFSL */
 
-   for (i = 1; (x & 1) == 0; i++, x >>= 1);
+#ifndef CK_F_CC_FFSLL
+#define CK_F_CC_FFSLL
+CK_F_CC_FFS_G(ffsll, unsigned long long)
+#endif /* CK_F_CC_FFSLL */
 
-   return i;
-}
-#endif
+#undef CK_F_CC_FFS_G
 
-#ifndef CK_F_CC_CLZ
-#define CK_F_CC_CLZ
-#include 
-
-CK_CC_INLINE static int
-ck_cc_clz(unsigned int x)
-{
-   unsigned int count, i;
-
-   for (count = 0, i = sizeof(unsigned int) * CHAR_BIT; i > 0; count++) {
-   unsigned int bit = 1U << --i;
-
-   if (x & bit)
-   break;
-   }
-
-   return count;
-}
-#endif
-
 #ifndef CK_F_CC_CTZ
 #define CK_F_CC_CTZ
 CK_CC_INLINE static int
@@ -151,7 +145,6 @@ ck_cc_ctz(unsigned int x)
return 0;
 
for (i = 0; (x & 1) == 0; i++, x >>= 1);
-
return i;
 }
 #endif

Modified: head/sys/contrib/ck/include/ck_hs.h
==
--- head/sys/contrib/ck/include/ck_hs.h Mon Apr  2 23:39:04 2018
(r331897)
+++ head/sys/contrib/ck/include/ck_hs.h Mon Apr  2 23:40:50 2018
(r331898)
@@ -100,10 +100,11 @@ struct ck_hs_stat {
 struct ck_hs_iterator {
void **cursor;
unsigned long offset;
+   struct ck_hs_map *map;
 };
 typedef struct ck_hs_iterator ck_hs_iterator_t;
 
-#define CK_HS_ITERATOR_INITIALIZER { NULL, 0 }
+#define CK_HS_ITERATOR_INITIALIZER { NULL, 0, NULL }
 
 /* Convenience wrapper to table hash function. */
 #define CK_HS_HASH(T, F, K) F((K), (T)->seed)
@@ -112,6 +113,7 @@ typedef void *ck_hs_apply_fn_t(void *, void *);
 bool ck_hs_apply(ck_hs_t *, unsigned long, const void *, ck_hs_apply_fn_t *, 
void *);
 void ck_hs_iterator_init(ck_hs_iterator_t *);
 bool ck_hs_next(ck_hs_t *, ck_hs_iterator_t *, void **);
+bool ck_hs_next_spmc(ck_hs_t *, ck_hs_iterator_t *, void **);
 bool ck_hs_move(ck_hs_t *, ck_hs_t *, ck_hs_hash_cb_t *,
 ck_hs_compare_cb_t *, struct ck_malloc *);
 bool ck_hs_init(ck_hs_t 

svn commit: r331896 - vendor-sys/ck/20180304

2018-04-02 Thread Olivier Houchard
Author: cognet
Date: Mon Apr  2 23:37:25 2018
New Revision: 331896
URL: https://svnweb.freebsd.org/changeset/base/331896

Log:
  Taf CK import as of commit b19ed4c6a56ec93215ab567ba18ba61bf1cfbac8

Added:
  vendor-sys/ck/20180304/
 - copied from r331895, vendor-sys/ck/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r331895 - in vendor-sys/ck/dist: include include/gcc include/gcc/sparcv9 include/gcc/x86 include/gcc/x86_64 include/spinlock src

2018-04-02 Thread Olivier Houchard
Author: cognet
Date: Mon Apr  2 23:35:32 2018
New Revision: 331895
URL: https://svnweb.freebsd.org/changeset/base/331895

Log:
  Import CK as of commit b19ed4c6a56ec93215ab567ba18ba61bf1cfbac8
  It should fix ck_pr_[load|store]_ptr on mips and riscv, make sure no
  *fence instructions are used on i386, as older cpus don't support it, and
  make sure we don't rely on gcc builtins that can lead to calls to
  libatomic when linked with -O0.

Modified:
  vendor-sys/ck/dist/include/ck_cc.h
  vendor-sys/ck/dist/include/ck_hs.h
  vendor-sys/ck/dist/include/ck_pr.h
  vendor-sys/ck/dist/include/ck_queue.h
  vendor-sys/ck/dist/include/ck_ring.h
  vendor-sys/ck/dist/include/gcc/ck_cc.h
  vendor-sys/ck/dist/include/gcc/ck_pr.h
  vendor-sys/ck/dist/include/gcc/sparcv9/ck_pr.h
  vendor-sys/ck/dist/include/gcc/x86/ck_pr.h
  vendor-sys/ck/dist/include/gcc/x86_64/ck_pr.h
  vendor-sys/ck/dist/include/spinlock/dec.h
  vendor-sys/ck/dist/src/ck_hs.c
  vendor-sys/ck/dist/src/ck_ht.c
  vendor-sys/ck/dist/src/ck_ht_hash.h
  vendor-sys/ck/dist/src/ck_internal.h
  vendor-sys/ck/dist/src/ck_rhs.c

Modified: vendor-sys/ck/dist/include/ck_cc.h
==
--- vendor-sys/ck/dist/include/ck_cc.h  Mon Apr  2 23:30:21 2018
(r331894)
+++ vendor-sys/ck/dist/include/ck_cc.h  Mon Apr  2 23:35:32 2018
(r331895)
@@ -104,42 +104,36 @@
 #define CK_CC_TYPEOF(X, DEFAULT) (DEFAULT)
 #endif
 
+#define CK_F_CC_FFS_G(L, T)\
+CK_CC_INLINE static int\
+ck_cc_##L(T v) \
+{  \
+   unsigned int i; \
+   \
+   if (v == 0) \
+   return 0;   \
+   \
+   for (i = 1; (v & 1) == 0; i++, v >>= 1);\
+   return i;   \
+}
+
 #ifndef CK_F_CC_FFS
 #define CK_F_CC_FFS
-CK_CC_INLINE static int
-ck_cc_ffs(unsigned int x)
-{
-   unsigned int i;
+CK_F_CC_FFS_G(ffs, unsigned int)
+#endif /* CK_F_CC_FFS */
 
-   if (x == 0)
-   return 0;
+#ifndef CK_F_CC_FFSL
+#define CK_F_CC_FFSL
+CK_F_CC_FFS_G(ffsl, unsigned long)
+#endif /* CK_F_CC_FFSL */
 
-   for (i = 1; (x & 1) == 0; i++, x >>= 1);
+#ifndef CK_F_CC_FFSLL
+#define CK_F_CC_FFSLL
+CK_F_CC_FFS_G(ffsll, unsigned long long)
+#endif /* CK_F_CC_FFSLL */
 
-   return i;
-}
-#endif
+#undef CK_F_CC_FFS_G
 
-#ifndef CK_F_CC_CLZ
-#define CK_F_CC_CLZ
-#include 
-
-CK_CC_INLINE static int
-ck_cc_clz(unsigned int x)
-{
-   unsigned int count, i;
-
-   for (count = 0, i = sizeof(unsigned int) * CHAR_BIT; i > 0; count++) {
-   unsigned int bit = 1U << --i;
-
-   if (x & bit)
-   break;
-   }
-
-   return count;
-}
-#endif
-
 #ifndef CK_F_CC_CTZ
 #define CK_F_CC_CTZ
 CK_CC_INLINE static int
@@ -151,7 +145,6 @@ ck_cc_ctz(unsigned int x)
return 0;
 
for (i = 0; (x & 1) == 0; i++, x >>= 1);
-
return i;
 }
 #endif

Modified: vendor-sys/ck/dist/include/ck_hs.h
==
--- vendor-sys/ck/dist/include/ck_hs.h  Mon Apr  2 23:30:21 2018
(r331894)
+++ vendor-sys/ck/dist/include/ck_hs.h  Mon Apr  2 23:35:32 2018
(r331895)
@@ -100,10 +100,11 @@ struct ck_hs_stat {
 struct ck_hs_iterator {
void **cursor;
unsigned long offset;
+   struct ck_hs_map *map;
 };
 typedef struct ck_hs_iterator ck_hs_iterator_t;
 
-#define CK_HS_ITERATOR_INITIALIZER { NULL, 0 }
+#define CK_HS_ITERATOR_INITIALIZER { NULL, 0, NULL }
 
 /* Convenience wrapper to table hash function. */
 #define CK_HS_HASH(T, F, K) F((K), (T)->seed)
@@ -112,6 +113,7 @@ typedef void *ck_hs_apply_fn_t(void *, void *);
 bool ck_hs_apply(ck_hs_t *, unsigned long, const void *, ck_hs_apply_fn_t *, 
void *);
 void ck_hs_iterator_init(ck_hs_iterator_t *);
 bool ck_hs_next(ck_hs_t *, ck_hs_iterator_t *, void **);
+bool ck_hs_next_spmc(ck_hs_t *, ck_hs_iterator_t *, void **);
 bool ck_hs_move(ck_hs_t *, ck_hs_t *, ck_hs_hash_cb_t *,
 ck_hs_compare_cb_t *, struct ck_malloc *);
 bool ck_hs_init(ck_hs_t *, unsigned int, ck_hs_hash_cb_t *,

Modified: vendor-sys/ck/dist/include/ck_pr.h
==
--- vendor-sys/ck/dist/include/ck_pr.h  Mon Apr  2 23:30:21 2018
(r331894)
+++ vendor-sys/ck/dist/include/ck_pr.h  Mon Apr  2 23:35:32 2018
(r331895)
@@ -43,6 +43,8 @@
 #include "gcc/sparcv9/ck_pr.h"
 #elif defined(__ppc64__)
 #include "gcc/ppc64/ck_pr.h"
+#elif defined(__s390x__)
+#include "gcc/s390x/ck_pr.h"
 #elif defined(__ppc__)
 #include "gcc/ppc/ck_pr.h"
 #elif defined(__arm__)

Modified: 

svn commit: r331441 - head/sys/mips/mips

2018-03-23 Thread Olivier Houchard
Author: cognet
Date: Fri Mar 23 17:25:19 2018
New Revision: 331441
URL: https://svnweb.freebsd.org/changeset/base/331441

Log:
  In __sync_bool_compare_and_swap(), return true if the returned value is the
  same as the expected one, not the desired one.
  
  Pointy hat to:cognet
  MFC after:3 days

Modified:
  head/sys/mips/mips/stdatomic.c

Modified: head/sys/mips/mips/stdatomic.c
==
--- head/sys/mips/mips/stdatomic.c  Fri Mar 23 17:22:28 2018
(r331440)
+++ head/sys/mips/mips/stdatomic.c  Fri Mar 23 17:25:19 2018
(r331441)
@@ -327,7 +327,7 @@ __sync_bool_compare_and_swap_4(uint32_t *mem, uint32_t
 {
 
return (do_compare_and_swap_4(mem, expected, desired) ==
-   desired);
+   expected);
 }
 
 #defineEMIT_FETCH_AND_OP_4(name, op)   
\
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r330018 - head/sys/arm64/arm64

2018-02-26 Thread Olivier Houchard
Author: cognet
Date: Mon Feb 26 13:12:51 2018
New Revision: 330018
URL: https://svnweb.freebsd.org/changeset/base/330018

Log:
  In do_ast, make sure the interrupts are enabled before calling ast().
  We can reach that point with IRQs disabled, and calling ast() with IRQs 
  disabled can lead to a deadlock.
  This should fix the freezes on arm64 under load.
  
  Reviewed by:  andrew

Modified:
  head/sys/arm64/arm64/exception.S

Modified: head/sys/arm64/arm64/exception.S
==
--- head/sys/arm64/arm64/exception.SMon Feb 26 12:01:42 2018
(r330017)
+++ head/sys/arm64/arm64/exception.SMon Feb 26 13:12:51 2018
(r330018)
@@ -26,6 +26,7 @@
  */
 
 #include 
+#include 
 __FBSDID("$FreeBSD$");
 
 #include "assym.s"
@@ -114,9 +115,11 @@ __FBSDID("$FreeBSD$");
 .endm
 
 .macro do_ast
-   /* Disable interrupts */
mrs x19, daif
+   /* Make sure the IRQs are enabled before calling ast() */
+   bic x19, x19, #PSR_I
 1:
+   /* Disable interrupts */
msr daifset, #2
 
/* Read the current thread flags */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r329908 - head/sys/arm/arm

2018-02-24 Thread Olivier Houchard
Author: cognet
Date: Sat Feb 24 14:34:23 2018
New Revision: 329908
URL: https://svnweb.freebsd.org/changeset/base/329908

Log:
  Use NULL as a mtx type instead of "", as it otherwise confuses WITNESS.

Modified:
  head/sys/arm/arm/gic.c

Modified: head/sys/arm/arm/gic.c
==
--- head/sys/arm/arm/gic.c  Sat Feb 24 13:04:02 2018(r329907)
+++ head/sys/arm/arm/gic.c  Sat Feb 24 14:34:23 2018(r329908)
@@ -448,7 +448,7 @@ arm_gic_attach(device_t dev)
gic_sc = sc;
 
/* Initialize mutex */
-   mtx_init(>mutex, "GIC lock", "", MTX_SPIN);
+   mtx_init(>mutex, "GIC lock", NULL, MTX_SPIN);
 
/* Distributor Interface */
sc->gic_d_bst = rman_get_bustag(sc->gic_res[0]);
@@ -1423,7 +1423,7 @@ arm_gicv2m_attach(device_t dev)
arm_gic_reserve_msi_range(device_get_parent(dev), sc->sc_spi_start,
sc->sc_spi_count);
 
-   mtx_init(>sc_mutex, "GICv2m lock", "", MTX_DEF);
+   mtx_init(>sc_mutex, "GICv2m lock", NULL, MTX_DEF);
 
intr_msi_register(dev, sc->sc_xref);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r329388 - head/sys/contrib/ck/include

2018-02-16 Thread Olivier Houchard
Author: cognet
Date: Fri Feb 16 17:50:06 2018
New Revision: 329388
URL: https://svnweb.freebsd.org/changeset/base/329388

Log:
  Define CK_MD_TSO for the relevant arches (i386, amd64 and sparc64).
  Defaulting to CK_MD_RMO has the unfortunate side effect of generating
  memory barriers that are useless on those arches, and the even more
  unfortunate side effect of generating lfence/sfence/mfence on i386, even
  if older CPUs don't support it.
  This should fix the panic reported when using IPFW on a Pentium 3.
  Note that mfence and sfence might still be used in a few case, but that
  shouldn't happen in FreeBSD right now, and should be fixed upstream first.
  
  MFC after:1 week

Modified:
  head/sys/contrib/ck/include/ck_md.h

Modified: head/sys/contrib/ck/include/ck_md.h
==
--- head/sys/contrib/ck/include/ck_md.h Fri Feb 16 17:46:07 2018
(r329387)
+++ head/sys/contrib/ck/include/ck_md.h Fri Feb 16 17:50:06 2018
(r329388)
@@ -53,10 +53,6 @@
 #define CK_PR_DISABLE_DOUBLE
 #endif /* CK_PR_DISABLE_DOUBLE */
 
-#ifndef CK_MD_RMO
-#define CK_MD_RMO
-#endif /* CK_MD_RMO */
-
 #define CK_VERSION "0.6.0"
 #define CK_GIT_SHA ""
 
@@ -65,11 +61,20 @@
  */
 #if defined(__i386__) && !defined(__x86__)
 #define __x86__
+#define CK_MD_TSO
+#elif defined(__amd64__)
+#define CK_MD_TSO
 #elif defined(__sparc64__) && !defined(__sparcv9__)
 #define __sparcv9__
+#define CK_MD_TSO
 #elif defined(__powerpc64__) && !defined(__ppc64__)
 #define __ppc64__
 #elif defined(__powerpc__) && !defined(__ppc__)
 #define __ppc__
 #endif
+
+#if !defined(CK_MD_RMO) && !defined(CK_MD_TSO) && !defined(CK_MD_PSO)
+#define CK_MD_RMO
+#endif
+
 #endif /* CK_MD_H */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r329317 - head/sys/arm/arm

2018-02-15 Thread Olivier Houchard
Author: cognet
Date: Thu Feb 15 15:46:14 2018
New Revision: 329317
URL: https://svnweb.freebsd.org/changeset/base/329317

Log:
  Rename the ACPI variant of the gicv2m driver from "gicv2m" to "gicv2m_acpi".
  The FDT variant is called "gicv2m" too, and as both would try to register
  on gic, only one of them would succeed, while we want them both in a
  GENERIC kernel.
  
  Reviewed by:  andrew

Modified:
  head/sys/arm/arm/gic_acpi.c

Modified: head/sys/arm/arm/gic_acpi.c
==
--- head/sys/arm/arm/gic_acpi.c Thu Feb 15 15:33:17 2018(r329316)
+++ head/sys/arm/arm/gic_acpi.c Thu Feb 15 15:46:14 2018(r329317)
@@ -342,5 +342,5 @@ DEFINE_CLASS_1(gicv2m, arm_gicv2m_acpi_driver, arm_gic
 
 static devclass_t arm_gicv2m_acpi_devclass;
 
-EARLY_DRIVER_MODULE(gicv2m, gic, arm_gicv2m_acpi_driver,
+EARLY_DRIVER_MODULE(gicv2m_acpi, gic, arm_gicv2m_acpi_driver,
 arm_gicv2m_acpi_devclass, 0, 0, BUS_PASS_INTERRUPT + 
BUS_PASS_ORDER_MIDDLE);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r328515 - in stable/11/sys: conf contrib/ck contrib/ck/include contrib/ck/include/gcc contrib/ck/include/gcc/aarch64 contrib/ck/include/gcc/arm contrib/ck/include/gcc/ppc64 contrib/ck/i...

2018-01-28 Thread Olivier Houchard
quot;1:"   \
-"ldxr" W " %" R "0, [%2];"\
- I " %" R "0, %" R "0, %" R "3;"   \
-"stxr" W " %w1, %" R "0, [%2];"\
-"cbnz %w1, 1b;"\
-   : "=" (previous), \
- "=" (tmp)   \
-   : "r"   (target),   \
- "r"   (delta) \
-   : "memory", "cc");  \
-   return; \
-   }
-
-CK_PR_BINARY(and, ptr, void, uintptr_t, "and", "", "")
-CK_PR_BINARY(add, ptr, void, uintptr_t, "add", "", "")
-CK_PR_BINARY(or, ptr, void, uintptr_t, "orr", "", "")
-CK_PR_BINARY(sub, ptr, void, uintptr_t, "sub", "", "")
-CK_PR_BINARY(xor, ptr, void, uintptr_t, "eor", "", "")
-CK_PR_BINARY(and, 64, uint64_t, uint64_t, "and", "", "")
-CK_PR_BINARY(add, 64, uint64_t, uint64_t, "add", "", "")
-CK_PR_BINARY(or, 64, uint64_t, uint64_t, "orr", "", "")
-CK_PR_BINARY(sub, 64, uint64_t, uint64_t, "sub", "", "")
-CK_PR_BINARY(xor, 64, uint64_t, uint64_t, "eor", "", "")
-
-#define CK_PR_BINARY_S(S, T, W)\
-   CK_PR_BINARY(and, S, T, T, "and", W, "w")   \
-   CK_PR_BINARY(add, S, T, T, "add", W, "w")   \
-   CK_PR_BINARY(or, S, T, T, "orr", W, "w")\
-   CK_PR_BINARY(sub, S, T, T, "sub", W, "w")   \
-   CK_PR_BINARY(xor, S, T, T, "eor", W, "w")
-
-CK_PR_BINARY_S(32, uint32_t, "")
-CK_PR_BINARY_S(uint, unsigned int, "")
-CK_PR_BINARY_S(int, int, "")
-CK_PR_BINARY_S(16, uint16_t, "h")
-CK_PR_BINARY_S(8, uint8_t, "b")
-CK_PR_BINARY_S(short, short, "h")
-CK_PR_BINARY_S(char, char, "b")
-
-#undef CK_PR_BINARY_S
-#undef CK_PR_BINARY
-
-CK_CC_INLINE static void *
-ck_pr_faa_ptr(void *target, uintptr_t delta)
-{
-   uintptr_t previous, r, tmp;
-
-   __asm__ __volatile__("1:"
-"ldxr %0, [%3];"
-"add %1, %4, %0;"
-"stxr %w2, %1, [%3];"
-"cbnz %w2, 1b;"
-   : "=" (previous),
- "=" (r),
- "=" (tmp)
-   : "r"   (target),
- "r"   (delta)
-   : "memory", "cc");
-
-   return (void *)(previous);
-}
-
-CK_CC_INLINE static uint64_t
-ck_pr_faa_64(uint64_t *target, uint64_t delta)
-{
-uint64_t previous, r, tmp;
-
-__asm__ __volatile__("1:"
- "ldxr %0, [%3];"
- "add %1, %4, %0;"
- "stxr %w2, %1, [%3];"
- "cbnz %w2, 1b;"
-: "=" (previous),
-  "=" (r),
-  "=" (tmp)
-: "r"   (target),
-  "r"   (delta)
-: "memory", "cc");
-
-return (previous);
-}
-
-#define CK_PR_FAA(S, T, W) \
-   CK_CC_INLINE static T   \
-   ck_pr_faa_##S(T *target, T delta)   \
-   {   \
-   T previous, r, tmp; \
-   __asm__ __volatile__("1:"   \
-"ldxr" W " %w0, [%3];" \
-"add %w1, %w4, %w0;"   \
-"stxr" W " %w2, %w1, [%3];"\
-"cbnz %w2, 1b;"\
-   : "=

svn commit: r323784 - head/sys/arm/include

2017-09-19 Thread Olivier Houchard
Author: cognet
Date: Tue Sep 19 23:41:55 2017
New Revision: 323784
URL: https://svnweb.freebsd.org/changeset/base/323784

Log:
  Define CPU_XSCALE_CORE3 when relevant.
  It was lost when cpuconf.h was deobirted.

Modified:
  head/sys/arm/include/pmap-v4.h

Modified: head/sys/arm/include/pmap-v4.h
==
--- head/sys/arm/include/pmap-v4.h  Tue Sep 19 23:28:22 2017
(r323783)
+++ head/sys/arm/include/pmap-v4.h  Tue Sep 19 23:41:55 2017
(r323784)
@@ -356,6 +356,7 @@ extern int pmap_needs_pte_sync;
 #endif /* ARM_NMMUS > 1 */
 
 #if defined(CPU_XSCALE_81342)
+#define CPU_XSCALE_CORE3
 #define PMAP_NEEDS_PTE_SYNC1
 #define PMAP_INCLUDE_PTE_SYNC
 #else
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r323777 - head/sys/arm/xscale/i8134x

2017-09-19 Thread Olivier Houchard
Author: cognet
Date: Tue Sep 19 20:33:22 2017
New Revision: 323777
URL: https://svnweb.freebsd.org/changeset/base/323777

Log:
  i81342 is little endian, not big endian.

Modified:
  head/sys/arm/xscale/i8134x/std.i81342

Modified: head/sys/arm/xscale/i8134x/std.i81342
==
--- head/sys/arm/xscale/i8134x/std.i81342   Tue Sep 19 20:24:13 2017
(r323776)
+++ head/sys/arm/xscale/i8134x/std.i81342   Tue Sep 19 20:33:22 2017
(r323777)
@@ -1,5 +1,6 @@
 #XScale i81342 generic configuration
 #$FreeBSD$
 files  "../xscale/i8134x/files.i81342"
-include"../xscale/std.xscale-be"
+include"../xscale/std.xscale"
 cpuCPU_XSCALE_81342
+machinearm
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r323490 - head/sys/arm/ti

2017-09-12 Thread Olivier Houchard
Author: cognet
Date: Tue Sep 12 10:43:02 2017
New Revision: 323490
URL: https://svnweb.freebsd.org/changeset/base/323490

Log:
  Some devices come with the same name as TI devices, so we can't rely on the
  "probe" method of those drivers to mean we're on e TI SoC. Introduce a new
  function, ti_soc_is_supported(), and use it to be sure we're really a TI
  system.
  
  PR:   50

Modified:
  head/sys/arm/ti/ti_cpuid.c
  head/sys/arm/ti/ti_cpuid.h
  head/sys/arm/ti/ti_scm.c

Modified: head/sys/arm/ti/ti_cpuid.c
==
--- head/sys/arm/ti/ti_cpuid.c  Tue Sep 12 06:34:02 2017(r323489)
+++ head/sys/arm/ti/ti_cpuid.c  Tue Sep 12 10:43:02 2017(r323490)
@@ -272,11 +272,7 @@ am335x_get_revision(void)
 static void
 ti_cpu_ident(void *dummy)
 {
-   phandle_t root;
-
-   root = OF_finddevice("/");
-   if (!ofw_bus_node_is_compatible(root, "ti,omap4") &&
-   !ofw_bus_node_is_compatible(root, "ti,am33xx"))
+   if (!ti_soc_is_supported())
return;
switch(ti_chip()) {
case CHIP_OMAP_4:

Modified: head/sys/arm/ti/ti_cpuid.h
==
--- head/sys/arm/ti/ti_cpuid.h  Tue Sep 12 06:34:02 2017(r323489)
+++ head/sys/arm/ti/ti_cpuid.h  Tue Sep 12 10:43:02 2017(r323490)
@@ -80,4 +80,10 @@ static __inline int ti_chip(void)
 
 uint32_t ti_revision(void);
 
+static __inline bool ti_soc_is_supported(void)
+{
+
+   return (_ti_chip != -1);
+}
+
 #endif  /* _TI_CPUID_H_ */

Modified: head/sys/arm/ti/ti_scm.c
==
--- head/sys/arm/ti/ti_scm.cTue Sep 12 06:34:02 2017(r323489)
+++ head/sys/arm/ti/ti_scm.cTue Sep 12 10:43:02 2017(r323490)
@@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include "ti_scm.h"
+#include "ti_cpuid.h"
 
 static struct resource_spec ti_scm_res_spec[] = {
{ SYS_RES_MEMORY,   0,  RF_ACTIVE },/* Control memory 
window */
@@ -86,6 +87,10 @@ static struct ti_scm_softc *ti_scm_sc;
 static int
 ti_scm_probe(device_t dev)
 {
+
+   if (!ti_soc_is_supported())
+   return (ENXIO);
+
if (!ofw_bus_status_okay(dev))
return (ENXIO);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r323101 - svnadmin/conf

2017-09-01 Thread Olivier Houchard
Author: cognet
Date: Fri Sep  1 16:50:59 2017
New Revision: 323101
URL: https://svnweb.freebsd.org/changeset/base/323101

Log:
  mw@ is doing fine, so release him from mentorship.

Modified:
  svnadmin/conf/mentors

Modified: svnadmin/conf/mentors
==
--- svnadmin/conf/mentors   Fri Sep  1 16:40:12 2017(r323100)
+++ svnadmin/conf/mentors   Fri Sep  1 16:50:59 2017(r323101)
@@ -25,7 +25,6 @@ kadesai   ken Co-mentor: scottl, 
ambrisko
 kevans emaste
 mahrensmckusick
 mjoras rstone
-mw cognet
 peterj jhb Co-mentor: grog
 rgrimesgrehan
 rlibby markj
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r321288 - svnadmin/conf

2017-07-20 Thread Olivier Houchard
Author: cognet
Date: Thu Jul 20 09:35:39 2017
New Revision: 321288
URL: https://svnweb.freebsd.org/changeset/base/321288

Log:
  Add Marcin Wojtas (mw@ as a new src committer.
  Marcin has been doing too many good work on the Marvell Armada code to
  be left unpunished.
  As this commit suggests, I'll act as his mentor.
  
  Approved by:  core

Modified:
  svnadmin/conf/access
  svnadmin/conf/mentors

Modified: svnadmin/conf/access
==
--- svnadmin/conf/accessThu Jul 20 08:11:06 2017(r321287)
+++ svnadmin/conf/accessThu Jul 20 09:35:39 2017(r321288)
@@ -147,6 +147,7 @@ mm
 mmel
 mp
 mr
+mw
 n_hibmadevnull
 neel
 netchild

Modified: svnadmin/conf/mentors
==
--- svnadmin/conf/mentors   Thu Jul 20 08:11:06 2017(r321287)
+++ svnadmin/conf/mentors   Thu Jul 20 09:35:39 2017(r321288)
@@ -22,6 +22,7 @@ jwd   rmacklem
 kadesaiken Co-mentor: scottl, ambrisko
 kevans emaste
 mahrensmckusick
+mw cognet
 peterj jhb Co-mentor: grog
 rgrimesgrehan
 rlibby markj
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r319904 - head/usr.bin/yes

2017-06-13 Thread Olivier Houchard
Author: cognet
Date: Tue Jun 13 16:19:32 2017
New Revision: 319904
URL: https://svnweb.freebsd.org/changeset/base/319904

Log:
  style(9) fixes.
  
  Reported by:  cem

Modified:
  head/usr.bin/yes/yes.c

Modified: head/usr.bin/yes/yes.c
==
--- head/usr.bin/yes/yes.c  Tue Jun 13 15:50:16 2017(r319903)
+++ head/usr.bin/yes/yes.c  Tue Jun 13 16:19:32 2017(r319904)
@@ -61,17 +61,14 @@ main(int argc, char **argv)
if (caph_limit_stdio() < 0 || (cap_enter() < 0 && errno != ENOSYS))
err(1, "capsicum");
 
-   if (argc > 1)
-   {
+   if (argc > 1) {
exp = argv[1];
explen = strlen(exp) + 1;
exp[explen - 1] = '\n';
}
 
-   if (explen <= sizeof(buf))
-   {
-   while (buflen < sizeof(buf) - explen)
-   {
+   if (explen <= sizeof(buf)) {
+   while (buflen < sizeof(buf) - explen) {
memcpy(buf + buflen, exp, explen);
buflen += explen;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r319496 - head/sys/arm64/arm64

2017-06-02 Thread Olivier Houchard
Author: cognet
Date: Fri Jun  2 14:17:14 2017
New Revision: 319496
URL: https://svnweb.freebsd.org/changeset/base/319496

Log:
  - Don't bother flushing the data cache for pages we're about to unmap, there's
  no need to.
  - Remove pmap_is_current(), pmap_[pte|l3]_valid_cacheable as there were only
  used to know if we had to write back pages.
  - In pmap_remove_pages(), don't bother invalidating each page in the TLB,
  we're about to flush the whole TLB anyway.
  
  This makes make world 8-9% faster on my hardware.
  
  Reviewed by:  andrew

Modified:
  head/sys/arm64/arm64/pmap.c

Modified: head/sys/arm64/arm64/pmap.c
==
--- head/sys/arm64/arm64/pmap.c Fri Jun  2 14:08:08 2017(r319495)
+++ head/sys/arm64/arm64/pmap.c Fri Jun  2 14:17:14 2017(r319496)
@@ -495,14 +495,6 @@ pmap_get_tables(pmap_t pmap, vm_offset_t va, pd_entry_
 }
 
 static __inline int
-pmap_is_current(pmap_t pmap)
-{
-
-   return ((pmap == pmap_kernel()) ||
-   (pmap == curthread->td_proc->p_vmspace->vm_map.pmap));
-}
-
-static __inline int
 pmap_l3_valid(pt_entry_t l3)
 {
 
@@ -510,24 +502,8 @@ pmap_l3_valid(pt_entry_t l3)
 }
 
 
-/* Is a level 1 or 2entry a valid block and cacheable */
 CTASSERT(L1_BLOCK == L2_BLOCK);
-static __inline int
-pmap_pte_valid_cacheable(pt_entry_t pte)
-{
 
-   return (((pte & ATTR_DESCR_MASK) == L1_BLOCK) &&
-   ((pte & ATTR_IDX_MASK) == ATTR_IDX(CACHED_MEMORY)));
-}
-
-static __inline int
-pmap_l3_valid_cacheable(pt_entry_t l3)
-{
-
-   return (((l3 & ATTR_DESCR_MASK) == L3_PAGE) &&
-   ((l3 & ATTR_IDX_MASK) == ATTR_IDX(CACHED_MEMORY)));
-}
-
 #definePTE_SYNC(pte)   cpu_dcache_wb_range((vm_offset_t)pte, 
sizeof(*pte))
 
 /*
@@ -1180,8 +1156,6 @@ pmap_kremove(vm_offset_t va)
KASSERT(pte != NULL, ("pmap_kremove: Invalid address"));
KASSERT(lvl == 3, ("pmap_kremove: Invalid pte level %d", lvl));
 
-   if (pmap_l3_valid_cacheable(pmap_load(pte)))
-   cpu_dcache_wb_range(va, L3_SIZE);
pmap_load_clear(pte);
PTE_SYNC(pte);
pmap_invalidate_page(kernel_pmap, va);
@@ -1292,8 +1266,6 @@ pmap_qremove(vm_offset_t sva, int count)
KASSERT(lvl == 3,
("Invalid device pagetable level: %d != 3", lvl));
if (pte != NULL) {
-   if (pmap_l3_valid_cacheable(pmap_load(pte)))
-   cpu_dcache_wb_range(va, L3_SIZE);
pmap_load_clear(pte);
PTE_SYNC(pte);
}
@@ -2295,8 +2267,6 @@ pmap_remove_l3(pmap_t pmap, pt_entry_t *l3, vm_offset_
vm_page_t m;
 
PMAP_LOCK_ASSERT(pmap, MA_OWNED);
-   if (pmap_is_current(pmap) && pmap_l3_valid_cacheable(pmap_load(l3)))
-   cpu_dcache_wb_range(va, L3_SIZE);
old_l3 = pmap_load_clear(l3);
PTE_SYNC(l3);
pmap_invalidate_page(pmap, va);
@@ -2518,9 +2488,6 @@ retry:
 
pte = pmap_l2_to_l3(pde, pv->pv_va);
tpte = pmap_load(pte);
-   if (pmap_is_current(pmap) &&
-   pmap_l3_valid_cacheable(tpte))
-   cpu_dcache_wb_range(pv->pv_va, L3_SIZE);
pmap_load_clear(pte);
PTE_SYNC(pte);
pmap_invalidate_page(pmap, pv->pv_va);
@@ -3004,10 +2971,6 @@ havel3:
}
goto validate;
}
-
-   /* Flush the cache, there might be uncommitted data in it */
-   if (pmap_is_current(pmap) && pmap_l3_valid_cacheable(orig_l3))
-   cpu_dcache_wb_range(va, L3_SIZE);
} else {
/*
 * Increment the counters.
@@ -3673,20 +3636,8 @@ pmap_remove_pages(pmap_t pmap)
("pmap_remove_pages: bad pte %#jx",
(uintmax_t)tpte));
 
-   if (pmap_is_current(pmap)) {
-   if (lvl == 2 &&
-   pmap_l3_valid_cacheable(tpte)) {
-   cpu_dcache_wb_range(pv->pv_va,
-   L3_SIZE);
-   } else if (lvl == 1 &&
-   pmap_pte_valid_cacheable(tpte)) {
-   cpu_dcache_wb_range(pv->pv_va,
-   L2_SIZE);
-   }
-   }
pmap_load_clear(pte);
PTE_SYNC(pte);
-   pmap_invalidate_page(pmap, pv->pv_va);
 
/*
 * Update the vm_page_t clean/reference bits.

svn commit: r317441 - head/sys/dev/ahci

2017-04-26 Thread Olivier Houchard
Author: cognet
Date: Wed Apr 26 16:13:22 2017
New Revision: 317441
URL: https://svnweb.freebsd.org/changeset/base/317441

Log:
  Check if the device is marked as dma-coherent in the FDT, and if so, let
  busdma know, so that on architectures where dma isn't always coherent, we
  know we don't have to write-back/invalidates cachelines on DMA operations.
  
  Reviewed by:  andrew, mav

Modified:
  head/sys/dev/ahci/ahci.c
  head/sys/dev/ahci/ahci.h
  head/sys/dev/ahci/ahci_generic.c

Modified: head/sys/dev/ahci/ahci.c
==
--- head/sys/dev/ahci/ahci.cWed Apr 26 14:50:06 2017(r317440)
+++ head/sys/dev/ahci/ahci.cWed Apr 26 16:13:22 2017(r317441)
@@ -249,7 +249,8 @@ ahci_attach(device_t dev)
(ctlr->caps & AHCI_CAP_64BIT) ? BUS_SPACE_MAXADDR :
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
BUS_SPACE_MAXSIZE, BUS_SPACE_UNRESTRICTED, BUS_SPACE_MAXSIZE,
-   0, NULL, NULL, >dma_tag)) {
+   ctlr->dma_coherent ? BUS_DMA_COHERENT : 0, NULL, NULL, 
+   >dma_tag)) {
ahci_free_mem(dev);
rman_fini(>sc_iomem);
return (ENXIO);

Modified: head/sys/dev/ahci/ahci.h
==
--- head/sys/dev/ahci/ahci.hWed Apr 26 14:50:06 2017(r317440)
+++ head/sys/dev/ahci/ahci.hWed Apr 26 16:13:22 2017(r317441)
@@ -519,6 +519,7 @@ struct ahci_controller {
void*argument;
} interrupt[AHCI_MAX_PORTS];
void(*ch_start)(struct ahci_channel *);
+   int dma_coherent;   /* DMA is cache-coherent */
 };
 
 enum ahci_err_type {

Modified: head/sys/dev/ahci/ahci_generic.c
==
--- head/sys/dev/ahci/ahci_generic.cWed Apr 26 14:50:06 2017
(r317440)
+++ head/sys/dev/ahci/ahci_generic.cWed Apr 26 16:13:22 2017
(r317441)
@@ -68,6 +68,8 @@ static struct ofw_compat_data compat_dat
 static int
 ahci_fdt_probe(device_t dev)
 {
+   struct ahci_controller *ctlr = device_get_softc(dev);
+   phandle_t node;
 
if (!ofw_bus_status_okay(dev))
return (ENXIO);
@@ -76,6 +78,8 @@ ahci_fdt_probe(device_t dev)
return (ENXIO);
 
device_set_desc_copy(dev, "AHCI SATA controller");
+   node = ofw_bus_get_node(dev);
+   ctlr->dma_coherent = OF_hasprop(node, "dma-coherent");
return (BUS_PROBE_DEFAULT);
 }
 #endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317428 - head/sys/arm/arm

2017-04-25 Thread Olivier Houchard
Author: cognet
Date: Tue Apr 25 23:46:53 2017
New Revision: 317428
URL: https://svnweb.freebsd.org/changeset/base/317428

Log:
  In arm_gicv2m_alloc_msi(), if we found a suitable irq range, leave the loop
  before we increase irq again, or we'd end up choosing an irq, and then
  really using the next one, even if it's not available.
  Also in the inner loop, correct the end check so that we check every irq,
  even the last one.
  This makes the msk(4) adapter able to use MSI on Softiron Overdrive 1000.

Modified:
  head/sys/arm/arm/gic.c

Modified: head/sys/arm/arm/gic.c
==
--- head/sys/arm/arm/gic.c  Tue Apr 25 23:43:37 2017(r317427)
+++ head/sys/arm/arm/gic.c  Tue Apr 25 23:46:53 2017(r317428)
@@ -1429,7 +1429,7 @@ arm_gicv2m_alloc_msi(device_t dev, devic
mtx_lock(>sc_mutex);
 
found = false;
-   for (irq = sc->sc_spi_start; irq < sc->sc_spi_end && !found; irq++) {
+   for (irq = sc->sc_spi_start; irq < sc->sc_spi_end; irq++) {
/* Start on an aligned interrupt */
if ((irq & (maxcount - 1)) != 0)
continue;
@@ -1438,7 +1438,7 @@ arm_gicv2m_alloc_msi(device_t dev, devic
found = true;
 
/* Check this range is valid */
-   for (end_irq = irq; end_irq != irq + count - 1; end_irq++) {
+   for (end_irq = irq; end_irq != irq + count; end_irq++) {
/* No free interrupts */
if (end_irq == sc->sc_spi_end) {
found = false;
@@ -1455,6 +1455,8 @@ arm_gicv2m_alloc_msi(device_t dev, devic
break;
}
}
+   if (found)
+   break;
}
 
/* Not enough interrupts were found */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317195 - head/sys/dev/ofw

2017-04-20 Thread Olivier Houchard
Author: cognet
Date: Thu Apr 20 15:06:16 2017
New Revision: 317195
URL: https://svnweb.freebsd.org/changeset/base/317195

Log:
  Update comment ot reflect realilty, we know also take care of CPUs that
  provide a enable-method.
  
  Suggested by: jhibbits

Modified:
  head/sys/dev/ofw/ofw_cpu.c

Modified: head/sys/dev/ofw/ofw_cpu.c
==
--- head/sys/dev/ofw/ofw_cpu.c  Thu Apr 20 14:22:33 2017(r317194)
+++ head/sys/dev/ofw/ofw_cpu.c  Thu Apr 20 15:06:16 2017(r317195)
@@ -315,7 +315,8 @@ ofw_cpu_early_foreach(ofw_cpu_foreach_cb
 
/*
 * If we are filtering by runnable then limit to only
-* those that have been enabled.
+* those that have been enabled, or do provide a method
+* to enable them.
 */
if (only_runnable) {
status[0] = '\0';
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317191 - head/sys/dev/ofw

2017-04-20 Thread Olivier Houchard
Author: cognet
Date: Thu Apr 20 13:56:06 2017
New Revision: 317191
URL: https://svnweb.freebsd.org/changeset/base/317191

Log:
  ePAPR states that any non-boot CPU will come in "disabled" state. So we should
  not consider a "disabled" cpu as a CPU we have to ignore, and we should use
  them if they provide a "enable-method".
  While I'm there, support "ok" as well as "okay", while ePAPR only accepts
  "okay", linux accepts "ok" too so we can expect it to be used.
  
  Reviewed by:  andrew (partially)

Modified:
  head/sys/dev/ofw/ofw_cpu.c

Modified: head/sys/dev/ofw/ofw_cpu.c
==
--- head/sys/dev/ofw/ofw_cpu.c  Thu Apr 20 13:46:55 2017(r317190)
+++ head/sys/dev/ofw/ofw_cpu.c  Thu Apr 20 13:56:06 2017(r317191)
@@ -320,8 +320,10 @@ ofw_cpu_early_foreach(ofw_cpu_foreach_cb
if (only_runnable) {
status[0] = '\0';
OF_getprop(child, "status", status, sizeof(status));
-   if (status[0] != '\0' && strcmp(status, "okay") != 0)
-   continue;
+   if (status[0] != '\0' && strcmp(status, "okay") != 0 &&
+   strcmp(status, "ok") != 0 &&
+   !OF_hasprop(child, "enable-method"))
+   continue;
}
 
/*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316702 - head/sys/mips/mips

2017-04-11 Thread Olivier Houchard
Author: cognet
Date: Tue Apr 11 13:31:27 2017
New Revision: 316702
URL: https://svnweb.freebsd.org/changeset/base/316702

Log:
  This file is also used in libcompiler_rt, so bring in stdbool.h if we're not
  in the kernel.

Modified:
  head/sys/mips/mips/stdatomic.c

Modified: head/sys/mips/mips/stdatomic.c
==
--- head/sys/mips/mips/stdatomic.c  Tue Apr 11 12:49:25 2017
(r316701)
+++ head/sys/mips/mips/stdatomic.c  Tue Apr 11 13:31:27 2017
(r316702)
@@ -33,6 +33,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#ifndef _KERNEL
+#include 
+#endif /* _KERNEL */
+
 #if defined(__SYNC_ATOMICS)
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r316665 - in head/sys: compat/linuxkpi/common/src contrib/ck/include contrib/ck/src

2017-04-10 Thread Olivier Houchard
On Mon, Apr 10, 2017 at 04:30:18PM -0400, Ed Maste wrote:
> On 9 April 2017 at 17:02, Olivier Houchard <cog...@freebsd.org> wrote:
> >
> > Author: cognet
> > Date: Sun Apr  9 21:02:05 2017
> > New Revision: 316665
> > URL: https://svnweb.freebsd.org/changeset/base/316665
> >
> > Log:
> >   Import CK as of commit 6b141c0bdd21ce8b3e14147af8f87f22b20ecf32
> >   This brings us changes we needed in ck_epoch.
> 
> My tinderbox build now fails when building MIPS kernels, e.g. from
> _.mips.OCTEON1:
> 
> ck_epoch.o: In function `ck_epoch_poll':
> /scratch/tmp/emaste/freebsd/sys/contrib/ck/src/ck_epoch.c:(.text+0x4b4):
> undefined reference to `__sync_bool_compare_and_swap_4'
> /scratch/tmp/emaste/freebsd/sys/contrib/ck/src/ck_epoch.c:(.text+0x4b4):
> relocation truncated to fit: R_MIPS_26 against
> `__sync_bool_compare_and_swap_4'

Hi Ed,

Sorry about that, it should be fixed now.

Regards,

Olivier
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316691 - head/sys/mips/mips

2017-04-10 Thread Olivier Houchard
Author: cognet
Date: Mon Apr 10 21:44:13 2017
New Revision: 316691
URL: https://svnweb.freebsd.org/changeset/base/316691

Log:
  Provide some kind of __sync_bool_compare_and_swap_4(), as it is used by CK,
  and our gcc is too ancient to provide it.
  This should fix the build on mips.

Modified:
  head/sys/mips/mips/stdatomic.c

Modified: head/sys/mips/mips/stdatomic.c
==
--- head/sys/mips/mips/stdatomic.c  Mon Apr 10 21:26:37 2017
(r316690)
+++ head/sys/mips/mips/stdatomic.c  Mon Apr 10 21:44:13 2017
(r316691)
@@ -287,8 +287,8 @@ EMIT_BITWISE_FETCH_AND_OP_N(2, uint16_t,
  * 32-bit routines.
  */
 
-uint32_t
-__sync_val_compare_and_swap_4(uint32_t *mem, uint32_t expected,
+static __inline uint32_t
+do_compare_and_swap_4(uint32_t *mem, uint32_t expected,
 uint32_t desired)
 {
uint32_t old, temp;
@@ -307,6 +307,23 @@ __sync_val_compare_and_swap_4(uint32_t *
return (old);
 }
 
+uint32_t
+__sync_val_compare_and_swap_4(uint32_t *mem, uint32_t expected,
+uint32_t desired)
+{
+
+   return (do_compare_and_swap_4(mem, expected, desired));
+}
+
+bool
+__sync_bool_compare_and_swap_4(uint32_t *mem, uint32_t expected,
+uint32_t desired)
+{
+
+   return (do_compare_and_swap_4(mem, expected, desired) ==
+   desired);
+}
+
 #defineEMIT_FETCH_AND_OP_4(name, op)   
\
 uint32_t   \
 __sync_##name##_4(uint32_t *mem, uint32_t val) \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r316665 - in head/sys: compat/linuxkpi/common/src contrib/ck/include contrib/ck/src

2017-04-09 Thread Olivier Houchard
On Sun, Apr 09, 2017 at 03:49:57PM -0700, Conrad Meyer wrote:
> On Sun, Apr 9, 2017 at 2:02 PM, Olivier Houchard <cog...@freebsd.org> wrote:
> > Author: cognet
> > Date: Sun Apr  9 21:02:05 2017
> > New Revision: 316665
> > URL: https://svnweb.freebsd.org/changeset/base/316665
> >
> > Log:
> >   Import CK as of commit 6b141c0bdd21ce8b3e14147af8f87f22b20ecf32
> >   This brings us changes we needed in ck_epoch.
> 
> Out of curiosity ??? what changes did we need, and why?
> 

Hi Conrad,

What ck_epoch lacked was any way to do priority propagation, which led
to some nice deadlocks to the linuxkpi folks.

Regards,

Olivier
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316665 - in head/sys: compat/linuxkpi/common/src contrib/ck/include contrib/ck/src

2017-04-09 Thread Olivier Houchard
Author: cognet
Date: Sun Apr  9 21:02:05 2017
New Revision: 316665
URL: https://svnweb.freebsd.org/changeset/base/316665

Log:
  Import CK as of commit 6b141c0bdd21ce8b3e14147af8f87f22b20ecf32
  This brings us changes we needed in ck_epoch.

Modified:
  head/sys/compat/linuxkpi/common/src/linux_rcu.c
  head/sys/contrib/ck/include/ck_epoch.h
  head/sys/contrib/ck/src/ck_epoch.c

Modified: head/sys/compat/linuxkpi/common/src/linux_rcu.c
==
--- head/sys/compat/linuxkpi/common/src/linux_rcu.c Sun Apr  9 20:59:12 
2017(r316664)
+++ head/sys/compat/linuxkpi/common/src/linux_rcu.c Sun Apr  9 21:02:05 
2017(r316665)
@@ -105,7 +105,7 @@ linux_rcu_runtime_init(void *arg __unuse
ck_epoch_record_t *record;
 
record = malloc(sizeof(*record), M_LRCU, M_WAITOK | M_ZERO);
-   ck_epoch_register(_epoch, record);
+   ck_epoch_register(_epoch, record, NULL);
 
DPCPU_ID_SET(i, linux_reader_epoch_record, record);
}
@@ -116,7 +116,7 @@ linux_rcu_runtime_init(void *arg __unuse
 
record = malloc(sizeof(*record), M_LRCU, M_WAITOK | M_ZERO);
 
-   ck_epoch_register(_epoch, >epoch_record);
+   ck_epoch_register(_epoch, >epoch_record, NULL);
mtx_init(>head_lock, "LRCU-HEAD", NULL, MTX_DEF);
mtx_init(>sync_lock, "LRCU-SYNC", NULL, MTX_DEF);
TASK_INIT(>task, 0, linux_rcu_cleaner_func, record);
@@ -170,14 +170,14 @@ linux_srcu_get_record(void)
 * NOTE: The only records that are unregistered and can be
 * recycled are srcu_epoch_records.
 */
-   record = (struct srcu_epoch_record *)ck_epoch_recycle(_epoch);
+   record = (struct srcu_epoch_record *)ck_epoch_recycle(_epoch, 
NULL);
if (__predict_true(record != NULL))
return (record);
 
record = malloc(sizeof(*record), M_LRCU, M_WAITOK | M_ZERO);
mtx_init(>read_lock, "SRCU-READ", NULL, MTX_DEF | 
MTX_NOWITNESS);
mtx_init(>sync_lock, "SRCU-SYNC", NULL, MTX_DEF | 
MTX_NOWITNESS);
-   ck_epoch_register(_epoch, >epoch_record);
+   ck_epoch_register(_epoch, >epoch_record, NULL);
 
return (record);
 }

Modified: head/sys/contrib/ck/include/ck_epoch.h
==
--- head/sys/contrib/ck/include/ck_epoch.h  Sun Apr  9 20:59:12 2017
(r316664)
+++ head/sys/contrib/ck/include/ck_epoch.h  Sun Apr  9 21:02:05 2017
(r316665)
@@ -83,6 +83,7 @@ struct ck_epoch_ref {
 };
 
 struct ck_epoch_record {
+   ck_stack_entry_t record_next;
struct ck_epoch *global;
unsigned int state;
unsigned int epoch;
@@ -92,17 +93,16 @@ struct ck_epoch_record {
} local CK_CC_CACHELINE;
unsigned int n_pending;
unsigned int n_peak;
-   unsigned long n_dispatch;
+   unsigned int n_dispatch;
+   void *ct;
ck_stack_t pending[CK_EPOCH_LENGTH];
-   ck_stack_entry_t record_next;
 } CK_CC_CACHELINE;
 typedef struct ck_epoch_record ck_epoch_record_t;
 
 struct ck_epoch {
unsigned int epoch;
-   char pad[CK_MD_CACHELINE - sizeof(unsigned int)];
-   ck_stack_t records;
unsigned int n_free;
+   ck_stack_t records;
 };
 typedef struct ck_epoch ck_epoch_t;
 
@@ -110,7 +110,14 @@ typedef struct ck_epoch ck_epoch_t;
  * Internal functions.
  */
 void _ck_epoch_addref(ck_epoch_record_t *, ck_epoch_section_t *);
-void _ck_epoch_delref(ck_epoch_record_t *, ck_epoch_section_t *);
+bool _ck_epoch_delref(ck_epoch_record_t *, ck_epoch_section_t *);
+
+CK_CC_FORCE_INLINE static void *
+ck_epoch_record_ct(const ck_epoch_record_t *record)
+{
+
+   return ck_pr_load_ptr(>ct);
+}
 
 /*
  * Marks the beginning of an epoch-protected section.
@@ -160,9 +167,10 @@ ck_epoch_begin(ck_epoch_record_t *record
 }
 
 /*
- * Marks the end of an epoch-protected section.
+ * Marks the end of an epoch-protected section. Returns true if no more
+ * sections exist for the caller.
  */
-CK_CC_FORCE_INLINE static void
+CK_CC_FORCE_INLINE static bool
 ck_epoch_end(ck_epoch_record_t *record, ck_epoch_section_t *section)
 {
 
@@ -170,15 +178,19 @@ ck_epoch_end(ck_epoch_record_t *record, 
ck_pr_store_uint(>active, record->active - 1);
 
if (section != NULL)
-   _ck_epoch_delref(record, section);
+   return _ck_epoch_delref(record, section);
 
-   return;
+   return record->active == 0;
 }
 
 /*
  * Defers the execution of the function pointed to by the "cb"
  * argument until an epoch counter loop. This allows for a
  * non-blocking deferral.
+ *
+ * We can get away without a fence here due to the monotonic nature
+ * of the epoch counter. Worst case, this will result in some delays
+ * before object destruction.
  */
 CK_CC_FORCE_INLINE static void
 

svn commit: r316663 - vendor-sys/ck/20170407

2017-04-09 Thread Olivier Houchard
Author: cognet
Date: Sun Apr  9 20:54:33 2017
New Revision: 316663
URL: https://svnweb.freebsd.org/changeset/base/316663

Log:
  Tag new CK import.

Added:
  vendor-sys/ck/20170407/
 - copied from r316662, vendor-sys/ck/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316662 - in vendor-sys/ck/dist: include src

2017-04-09 Thread Olivier Houchard
Author: cognet
Date: Sun Apr  9 20:53:02 2017
New Revision: 316662
URL: https://svnweb.freebsd.org/changeset/base/316662

Log:
  Import CK as of commit 6b141c0bdd21ce8b3e14147af8f87f22b20ecf32
  This brings us changes we needed in ck_epoch.

Modified:
  vendor-sys/ck/dist/include/ck_epoch.h
  vendor-sys/ck/dist/src/ck_epoch.c

Modified: vendor-sys/ck/dist/include/ck_epoch.h
==
--- vendor-sys/ck/dist/include/ck_epoch.h   Sun Apr  9 20:41:00 2017
(r316661)
+++ vendor-sys/ck/dist/include/ck_epoch.h   Sun Apr  9 20:53:02 2017
(r316662)
@@ -83,6 +83,7 @@ struct ck_epoch_ref {
 };
 
 struct ck_epoch_record {
+   ck_stack_entry_t record_next;
struct ck_epoch *global;
unsigned int state;
unsigned int epoch;
@@ -92,17 +93,16 @@ struct ck_epoch_record {
} local CK_CC_CACHELINE;
unsigned int n_pending;
unsigned int n_peak;
-   unsigned long n_dispatch;
+   unsigned int n_dispatch;
+   void *ct;
ck_stack_t pending[CK_EPOCH_LENGTH];
-   ck_stack_entry_t record_next;
 } CK_CC_CACHELINE;
 typedef struct ck_epoch_record ck_epoch_record_t;
 
 struct ck_epoch {
unsigned int epoch;
-   char pad[CK_MD_CACHELINE - sizeof(unsigned int)];
-   ck_stack_t records;
unsigned int n_free;
+   ck_stack_t records;
 };
 typedef struct ck_epoch ck_epoch_t;
 
@@ -110,7 +110,14 @@ typedef struct ck_epoch ck_epoch_t;
  * Internal functions.
  */
 void _ck_epoch_addref(ck_epoch_record_t *, ck_epoch_section_t *);
-void _ck_epoch_delref(ck_epoch_record_t *, ck_epoch_section_t *);
+bool _ck_epoch_delref(ck_epoch_record_t *, ck_epoch_section_t *);
+
+CK_CC_FORCE_INLINE static void *
+ck_epoch_record_ct(const ck_epoch_record_t *record)
+{
+
+   return ck_pr_load_ptr(>ct);
+}
 
 /*
  * Marks the beginning of an epoch-protected section.
@@ -160,9 +167,10 @@ ck_epoch_begin(ck_epoch_record_t *record
 }
 
 /*
- * Marks the end of an epoch-protected section.
+ * Marks the end of an epoch-protected section. Returns true if no more
+ * sections exist for the caller.
  */
-CK_CC_FORCE_INLINE static void
+CK_CC_FORCE_INLINE static bool
 ck_epoch_end(ck_epoch_record_t *record, ck_epoch_section_t *section)
 {
 
@@ -170,15 +178,19 @@ ck_epoch_end(ck_epoch_record_t *record, 
ck_pr_store_uint(>active, record->active - 1);
 
if (section != NULL)
-   _ck_epoch_delref(record, section);
+   return _ck_epoch_delref(record, section);
 
-   return;
+   return record->active == 0;
 }
 
 /*
  * Defers the execution of the function pointed to by the "cb"
  * argument until an epoch counter loop. This allows for a
  * non-blocking deferral.
+ *
+ * We can get away without a fence here due to the monotonic nature
+ * of the epoch counter. Worst case, this will result in some delays
+ * before object destruction.
  */
 CK_CC_FORCE_INLINE static void
 ck_epoch_call(ck_epoch_record_t *record,
@@ -195,13 +207,74 @@ ck_epoch_call(ck_epoch_record_t *record,
return;
 }
 
+/*
+ * Same as ck_epoch_call, but allows for records to be shared and is reentrant.
+ */
+CK_CC_FORCE_INLINE static void
+ck_epoch_call_strict(ck_epoch_record_t *record,
+ ck_epoch_entry_t *entry,
+ ck_epoch_cb_t *function)
+{
+   struct ck_epoch *epoch = record->global;
+   unsigned int e = ck_pr_load_uint(>epoch);
+   unsigned int offset = e & (CK_EPOCH_LENGTH - 1);
+
+   ck_pr_inc_uint(>n_pending);
+   entry->function = function;
+
+   /* Store fence is implied by push operation. */
+   ck_stack_push_upmc(>pending[offset], >stack_entry);
+   return;
+}
+
+/*
+ * This callback is used for synchronize_wait to allow for custom blocking
+ * behavior.
+ */
+typedef void ck_epoch_wait_cb_t(ck_epoch_t *, ck_epoch_record_t *,
+void *);
+
+/*
+ * Return latest epoch value. This operation provides load ordering.
+ */
+CK_CC_FORCE_INLINE static unsigned int
+ck_epoch_value(const ck_epoch_t *ep)
+{
+
+   ck_pr_fence_load();
+   return ck_pr_load_uint(>epoch);
+}
+
 void ck_epoch_init(ck_epoch_t *);
-ck_epoch_record_t *ck_epoch_recycle(ck_epoch_t *);
-void ck_epoch_register(ck_epoch_t *, ck_epoch_record_t *);
+
+/*
+ * Attempts to recycle an unused epoch record. If one is successfully
+ * allocated, the record context pointer is also updated.
+ */
+ck_epoch_record_t *ck_epoch_recycle(ck_epoch_t *, void *);
+
+/*
+ * Registers an epoch record. An optional context pointer may be passed that
+ * is retrievable with ck_epoch_record_ct.
+ */
+void ck_epoch_register(ck_epoch_t *, ck_epoch_record_t *, void *);
+
+/*
+ * Marks a record as available for re-use by a subsequent recycle operation.
+ * Note that the record cannot be physically destroyed.
+ */
 void ck_epoch_unregister(ck_epoch_record_t *);
+
 bool ck_epoch_poll(ck_epoch_record_t *);
 void ck_epoch_synchronize(ck_epoch_record_t *);
+void 

svn commit: r314435 - in head/sys/contrib/ck: include src

2017-02-28 Thread Olivier Houchard
Author: cognet
Date: Tue Feb 28 23:30:14 2017
New Revision: 314435
URL: https://svnweb.freebsd.org/changeset/base/314435

Log:
  Merge CK as of commit 24d26965d1a28039062ba3bcf9433b623f3d2c5e, to get
  a fix in ck_epoch.

Modified:
  head/sys/contrib/ck/include/ck_md.h
  head/sys/contrib/ck/src/ck_epoch.c
Directory Properties:
  head/sys/contrib/ck/   (props changed)

Modified: head/sys/contrib/ck/include/ck_md.h
==
--- head/sys/contrib/ck/include/ck_md.h Tue Feb 28 23:26:59 2017
(r314434)
+++ head/sys/contrib/ck/include/ck_md.h Tue Feb 28 23:30:14 2017
(r314435)
@@ -57,7 +57,7 @@
 #define CK_MD_RMO
 #endif /* CK_MD_RMO */
 
-#define CK_VERSION "0.5.2"
+#define CK_VERSION "0.6.0"
 #define CK_GIT_SHA ""
 
 /*

Modified: head/sys/contrib/ck/src/ck_epoch.c
==
--- head/sys/contrib/ck/src/ck_epoch.c  Tue Feb 28 23:26:59 2017
(r314434)
+++ head/sys/contrib/ck/src/ck_epoch.c  Tue Feb 28 23:30:14 2017
(r314435)
@@ -309,11 +309,12 @@ ck_epoch_scan(struct ck_epoch *global,
 {
ck_stack_entry_t *cursor;
 
-   *af = false;
if (cr == NULL) {
cursor = CK_STACK_FIRST(>records);
+   *af = false;
} else {
cursor = >record_next;
+   *af = true;
}
 
while (cursor != NULL) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r314434 - vendor-sys/ck/20170228

2017-02-28 Thread Olivier Houchard
Author: cognet
Date: Tue Feb 28 23:26:59 2017
New Revision: 314434
URL: https://svnweb.freebsd.org/changeset/base/314434

Log:
  Tag CK import as of commit 24d26965d1a28039062ba3bcf9433b623f3d2c5e

Added:
  vendor-sys/ck/20170228/
 - copied from r314432, vendor-sys/ck/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r314432 - vendor-sys/ck/dist/src

2017-02-28 Thread Olivier Houchard
Author: cognet
Date: Tue Feb 28 23:24:08 2017
New Revision: 314432
URL: https://svnweb.freebsd.org/changeset/base/314432

Log:
  Import CK as of commit 24d26965d1a28039062ba3bcf9433b623f3d2c5e, to get
  a fix in ck_epoch

Modified:
  vendor-sys/ck/dist/src/ck_epoch.c

Modified: vendor-sys/ck/dist/src/ck_epoch.c
==
--- vendor-sys/ck/dist/src/ck_epoch.c   Tue Feb 28 23:03:51 2017
(r314431)
+++ vendor-sys/ck/dist/src/ck_epoch.c   Tue Feb 28 23:24:08 2017
(r314432)
@@ -309,11 +309,12 @@ ck_epoch_scan(struct ck_epoch *global,
 {
ck_stack_entry_t *cursor;
 
-   *af = false;
if (cr == NULL) {
cursor = CK_STACK_FIRST(>records);
+   *af = false;
} else {
cursor = >record_next;
+   *af = true;
}
 
while (cursor != NULL) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r314186 - head/sys/arm/at91

2017-02-23 Thread Olivier Houchard
On Thu, Feb 23, 2017 at 07:23:36PM -0500, Pedro Giffuni wrote:
> Hi;
> 
> > Il giorno 23 feb 2017, alle ore 19:05, Ian Lepore  ha 
> > scritto:
> > 
> > On Thu, 2017-02-23 at 23:48 +, Pedro F. Giffuni wrote:
> >> Author: pfg
> >> Date: Thu Feb 23 23:48:44 2017
> >> New Revision: 314186
> >> URL: https://svnweb.freebsd.org/changeset/base/314186
> >> 
> >> Log:
> >>   at91: double assignment.
> >>   
> >>   Found with:  coccinelle (da.cocci)
> >>   Suggested by:cognet
> >> 
> >> Modified:
> >>   head/sys/arm/at91/at91sam9260.c
> >> 
> >> Modified: head/sys/arm/at91/at91sam9260.c
> >> =
> >> =
> >> --- head/sys/arm/at91/at91sam9260.cThu Feb 23 22:46:01 2017
> >> (r314185)
> >> +++ head/sys/arm/at91/at91sam9260.cThu Feb 23 23:48:44 2017
> >> (r314186)
> >> @@ -193,7 +193,6 @@ at91_clock_init(void)
> >> */
> >>clk = at91_pmc_clock_ref("pllb");
> >>clk->pll_min_in= SAM9260_PLL_B_MIN_IN_FREQ; 
> >> /*   1 MHz */
> >> -  clk->pll_max_in= SAM9260_PLL_B_MAX_IN_FREQ; 
> >> /*   5 MHz */
> >>clk->pll_max_in= 299;   
> >> /*  ~3 MHz */
> >>clk->pll_min_out   = SAM9260_PLL_B_MIN_OUT_FREQ;/*  
> >> 70 MHz */
> >>clk->pll_max_out   = SAM9260_PLL_B_MAX_OUT_FREQ;/*
> >> 130 MHz */
> >> 
> > 
> > Just looking at this by eye (but without digging out the at91 manuals)
> > I'd say this looks like fallout from a mismerge and the correct line to
> > keep would be the named constant.  Keeping the one that has actually
> > been in effect all this time isn't the same as keeping the right one,
> > and this deletion may remove the only clue someone might find when they
> > eventually get around to debugging this (if ever, the sam9260 is a
> > pretty old chip).
> > 
> > -- ian
> > 
> > 
> 
> According to SVN annotations it is not a mismerge:. The first line looks more 
> technical but cognet@ stated from the second one is correct and matches the 
> (long) initial comment.
> 
> It???s also what is in effective use now, so I wouldn???t change it unless 
> someone with the hardware confirms first.
> 

As Pedro says, there's a large comment that says :
 * Fudge MAX pll in frequence down below 3.0 MHz to ensure
 * PMC alogrithm choose the divisor that causes the input clock
 * to be near the optimal 2 MHz per datasheet.  We know
 * we are going to be using this for the USB
 * clock at 96 MHz.
 * Causes no extra frequency deviation  for all recommended crystal
 * values.  See Note 1, table 40-16 SAM9260 doc.
 

So I just assumed it was OK. (And it's been that way since the code was
first submitted).

Olivier

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r313708 - head/sys/arm/arm

2017-02-13 Thread Olivier Houchard
Author: cognet
Date: Mon Feb 13 20:51:08 2017
New Revision: 313708
URL: https://svnweb.freebsd.org/changeset/base/313708

Log:
  Remove debugging code that was probably unused since before the arm code
  was initially committed.
  
  Reported by:  Alexandre Martins 

Modified:
  head/sys/arm/arm/cpufunc_asm.S

Modified: head/sys/arm/arm/cpufunc_asm.S
==
--- head/sys/arm/arm/cpufunc_asm.S  Mon Feb 13 20:36:28 2017
(r313707)
+++ head/sys/arm/arm/cpufunc_asm.S  Mon Feb 13 20:51:08 2017
(r313708)
@@ -124,9 +124,6 @@ ENTRY(cpufunc_control)
mov r0, r3  /* Return old value */
 
RET
-.Lglou:
-   .asciz "plop %p\n"
-   .align 2
 END(cpufunc_control)
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312949 - head/sys/arm/include

2017-01-29 Thread Olivier Houchard
Author: cognet
Date: Sun Jan 29 13:31:56 2017
New Revision: 312949
URL: https://svnweb.freebsd.org/changeset/base/312949

Log:
  Correct the IT instruction in atomic_fcmpset_64().
  
  Reported by:  andrew

Modified:
  head/sys/arm/include/atomic-v6.h

Modified: head/sys/arm/include/atomic-v6.h
==
--- head/sys/arm/include/atomic-v6.hSun Jan 29 12:31:24 2017
(r312948)
+++ head/sys/arm/include/atomic-v6.hSun Jan 29 13:31:56 2017
(r312949)
@@ -220,7 +220,7 @@ atomic_fcmpset_64(volatile uint64_t *p, 
"1: mov %[ret], #1  \n"
"   ldrexd  %Q[tmp], %R[tmp], [%[ptr]]  \n"
"   teq %Q[tmp], %Q[_cmpval]\n"
-   "   iteeeq  \n"
+   "   ite eq  \n"
"   teqeq   %R[tmp], %R[_cmpval]\n"
"   bne 2f  \n"
"   strexd  %[ret], %Q[newval], %R[newval], [%[ptr]]\n"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312933 - head/sys/arm/include

2017-01-28 Thread Olivier Houchard
Author: cognet
Date: Sat Jan 28 17:48:33 2017
New Revision: 312933
URL: https://svnweb.freebsd.org/changeset/base/312933

Log:
  Remove useless labels.

Modified:
  head/sys/arm/include/atomic-v6.h

Modified: head/sys/arm/include/atomic-v6.h
==
--- head/sys/arm/include/atomic-v6.hSat Jan 28 17:46:04 2017
(r312932)
+++ head/sys/arm/include/atomic-v6.hSat Jan 28 17:48:33 2017
(r312933)
@@ -198,12 +198,11 @@ atomic_fcmpset_32(volatile uint32_t *p, 
int ret;
 
__asm __volatile(
-   "1: mov %0, #1  \n"
+   "   mov %0, #1  \n"
"   ldrex   %1, [%2]\n"
"   cmp %1, %3  \n"
"   it  eq  \n"
"   strexeq %0, %4, [%2]\n"
-   "2:"
: "=" (ret), "=" (tmp), "+r" (p), "+r" (_cmpval), "+r" (newval)
: : "cc", "memory");
*cmpval = tmp;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312932 - head/sys/arm/include

2017-01-28 Thread Olivier Houchard
Author: cognet
Date: Sat Jan 28 17:46:04 2017
New Revision: 312932
URL: https://svnweb.freebsd.org/changeset/base/312932

Log:
  Use strexeq instead of needlessly branch.
  
  Suggested by: ian

Modified:
  head/sys/arm/include/atomic-v6.h

Modified: head/sys/arm/include/atomic-v6.h
==
--- head/sys/arm/include/atomic-v6.hSat Jan 28 17:40:37 2017
(r312931)
+++ head/sys/arm/include/atomic-v6.hSat Jan 28 17:46:04 2017
(r312932)
@@ -201,9 +201,8 @@ atomic_fcmpset_32(volatile uint32_t *p, 
"1: mov %0, #1  \n"
"   ldrex   %1, [%2]\n"
"   cmp %1, %3  \n"
-   "   it  ne  \n"
-   "   bne 2f  \n"
-   "   strex   %0, %4, [%2]\n"
+   "   it  eq  \n"
+   "   strexeq %0, %4, [%2]\n"
"2:"
: "=" (ret), "=" (tmp), "+r" (p), "+r" (_cmpval), "+r" (newval)
: : "cc", "memory");
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312925 - in head/sys: arm/include arm64/include

2017-01-28 Thread Olivier Houchard
Author: cognet
Date: Sat Jan 28 16:24:06 2017
New Revision: 312925
URL: https://svnweb.freebsd.org/changeset/base/312925

Log:
  Implement atomic_fcmpset_* for arm and arm64.

Modified:
  head/sys/arm/include/atomic-v4.h
  head/sys/arm/include/atomic-v6.h
  head/sys/arm/include/atomic.h
  head/sys/arm64/include/atomic.h

Modified: head/sys/arm/include/atomic-v4.h
==
--- head/sys/arm/include/atomic-v4.hSat Jan 28 15:44:14 2017
(r312924)
+++ head/sys/arm/include/atomic-v4.hSat Jan 28 16:24:06 2017
(r312925)
@@ -112,6 +112,43 @@ atomic_clear_64(volatile uint64_t *addre
__with_interrupts_disabled(*address &= ~clearmask);
 }
 
+static __inline int
+atomic_fcmpset_32(volatile u_int32_t *p, volatile u_int32_t *cmpval, volatile 
u_int32_t newval)
+{
+   u_int32_t ret;
+
+   __with_interrupts_disabled(
+{
+   ret = *p;
+   if (*p == *cmpval) {
+   *p = newval;
+   ret = 1;
+   } else {
+   *cmpval = *p;
+   ret = 0;
+   }
+   });
+   return (ret);
+}
+
+static __inline int
+atomic_fcmpset_64(volatile u_int64_t *p, volatile u_int64_t *cmpval, volatile 
u_int64_t newval)
+{
+   u_int64_t ret;
+
+   __with_interrupts_disabled(
+{
+   if (*p == *cmpval) {
+   *p = newval;
+   ret = 1;
+   } else {
+   *cmpval = *p;
+   ret = 0;
+   }
+   });
+   return (ret);
+}
+
 static __inline u_int32_t
 atomic_cmpset_32(volatile u_int32_t *p, volatile u_int32_t cmpval, volatile 
u_int32_t newval)
 {
@@ -370,6 +407,12 @@ atomic_swap_32(volatile u_int32_t *p, u_
return (__swp(v, p));
 }
 
+#define atomic_fcmpset_rel_32  atomic_fcmpset_32
+#define atomic_fcmpset_acq_32  atomic_fcmpset_32
+#define atomic_fcmpset_rel_64  atomic_fcmpset_64
+#define atomic_fcmpset_acq_64  atomic_fcmpset_64
+#define atomic_fcmpset_acq_longatomic_fcmpset_long
+#define atomic_fcmpset_rel_longatomic_fcmpset_long
 #define atomic_cmpset_rel_32   atomic_cmpset_32
 #define atomic_cmpset_acq_32   atomic_cmpset_32
 #define atomic_cmpset_rel_64   atomic_cmpset_64
@@ -421,6 +464,14 @@ atomic_cmpset_long(volatile u_long *dst,
 }
 
 static __inline u_long
+atomic_fcmpset_long(volatile u_long *dst, u_long *old, u_long newe)
+{
+
+   return (atomic_fcmpset_32((volatile uint32_t *)dst,
+   (uint32_t *)old, newe));
+}
+
+static __inline u_long
 atomic_fetchadd_long(volatile u_long *p, u_long v)
 {
 

Modified: head/sys/arm/include/atomic-v6.h
==
--- head/sys/arm/include/atomic-v6.hSat Jan 28 15:44:14 2017
(r312924)
+++ head/sys/arm/include/atomic-v6.hSat Jan 28 16:24:06 2017
(r312925)
@@ -190,6 +190,116 @@ ATOMIC_ACQ_REL(clear, 32)
 ATOMIC_ACQ_REL(clear, 64)
 ATOMIC_ACQ_REL_LONG(clear)
 
+static __inline int
+atomic_fcmpset_32(volatile uint32_t *p, uint32_t *cmpval, uint32_t newval)
+{
+   uint32_t tmp;
+   uint32_t _cmpval = *cmpval;
+   int ret;
+
+   __asm __volatile(
+   "1: mov %0, #1  \n"
+   "   ldrex   %1, [%2]\n"
+   "   cmp %1, %3  \n"
+   "   it  ne  \n"
+   "   bne 2f  \n"
+   "   strex   %0, %4, [%2]\n"
+   "2:"
+   : "=" (ret), "=" (tmp), "+r" (p), "+r" (_cmpval), "+r" (newval)
+   : : "cc", "memory");
+   *cmpval = tmp;
+   return (!ret);
+}
+
+static __inline uint64_t
+atomic_fcmpset_64(volatile uint64_t *p, uint64_t *cmpval, uint64_t newval)
+{
+   uint64_t tmp;
+   uint64_t _cmpval = *cmpval;
+   int ret;
+
+   __asm __volatile(
+   "1: mov %[ret], #1  \n"
+   "   ldrexd  %Q[tmp], %R[tmp], [%[ptr]]  \n"
+   "   teq %Q[tmp], %Q[_cmpval]\n"
+   "   iteeeq  \n"
+   "   teqeq   %R[tmp], %R[_cmpval]\n"
+   "   bne 2f  \n"
+   "   strexd  %[ret], %Q[newval], %R[newval], [%[ptr]]\n"
+   "2: \n"
+   : [ret]"=" (ret),
+ [tmp]"=" (tmp)
+   : [ptr]"r"   (p),
+ [_cmpval] "r"   (_cmpval),
+ [newval] "r"   (newval)
+   : "cc", "memory");
+   *cmpval = tmp;
+   return (!ret);
+}
+
+static __inline u_long
+atomic_fcmpset_long(volatile u_long *p, u_long *cmpval, u_long newval)
+{
+
+   return (atomic_fcmpset_32((volatile uint32_t *)p, 
+   (uint32_t *)cmpval, newval));
+}
+
+static __inline uint64_t

svn commit: r311159 - head/sys/dev/xen/netfront

2017-01-03 Thread Olivier Houchard
Author: cognet
Date: Tue Jan  3 17:24:56 2017
New Revision: 311159
URL: https://svnweb.freebsd.org/changeset/base/311159

Log:
  In the netfront_rxq struct, we should use NET_RX_RING_SIZE, not
  NET_TX_RING_SIZE.
  
  Reviewed by:  royger

Modified:
  head/sys/dev/xen/netfront/netfront.c

Modified: head/sys/dev/xen/netfront/netfront.c
==
--- head/sys/dev/xen/netfront/netfront.cTue Jan  3 17:16:13 2017
(r311158)
+++ head/sys/dev/xen/netfront/netfront.cTue Jan  3 17:24:56 2017
(r311159)
@@ -168,7 +168,7 @@ struct netfront_rxq {
xen_intr_handle_t   xen_intr_handle;
 
grant_ref_t gref_head;
-   grant_ref_t grant_ref[NET_TX_RING_SIZE + 1];
+   grant_ref_t grant_ref[NET_RX_RING_SIZE + 1];
 
struct mbuf *mbufs[NET_RX_RING_SIZE + 1];
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310846 - in head/sys/contrib/ck: . include include/gcc include/gcc/aarch64 include/gcc/arm include/gcc/ppc64 include/gcc/x86_64 src

2016-12-30 Thread Olivier Houchard
  \
-   : "memory", "cc");  \
-   return; \
-   }
-
-CK_PR_BINARY(and, ptr, void, uintptr_t, "and", "", "")
-CK_PR_BINARY(add, ptr, void, uintptr_t, "add", "", "")
-CK_PR_BINARY(or, ptr, void, uintptr_t, "orr", "", "")
-CK_PR_BINARY(sub, ptr, void, uintptr_t, "sub", "", "")
-CK_PR_BINARY(xor, ptr, void, uintptr_t, "eor", "", "")
-CK_PR_BINARY(and, 64, uint64_t, uint64_t, "and", "", "")
-CK_PR_BINARY(add, 64, uint64_t, uint64_t, "add", "", "")
-CK_PR_BINARY(or, 64, uint64_t, uint64_t, "orr", "", "")
-CK_PR_BINARY(sub, 64, uint64_t, uint64_t, "sub", "", "")
-CK_PR_BINARY(xor, 64, uint64_t, uint64_t, "eor", "", "")
-
-#define CK_PR_BINARY_S(S, T, W)\
-   CK_PR_BINARY(and, S, T, T, "and", W, "w")   \
-   CK_PR_BINARY(add, S, T, T, "add", W, "w")   \
-   CK_PR_BINARY(or, S, T, T, "orr", W, "w")\
-   CK_PR_BINARY(sub, S, T, T, "sub", W, "w")   \
-   CK_PR_BINARY(xor, S, T, T, "eor", W, "w")
-
-CK_PR_BINARY_S(32, uint32_t, "")
-CK_PR_BINARY_S(uint, unsigned int, "")
-CK_PR_BINARY_S(int, int, "")
-CK_PR_BINARY_S(16, uint16_t, "h")
-CK_PR_BINARY_S(8, uint8_t, "b")
-CK_PR_BINARY_S(short, short, "h")
-CK_PR_BINARY_S(char, char, "b")
-
-#undef CK_PR_BINARY_S
-#undef CK_PR_BINARY
-
-CK_CC_INLINE static void *
-ck_pr_faa_ptr(void *target, uintptr_t delta)
-{
-   uintptr_t previous, r, tmp;
-
-   __asm__ __volatile__("1:"
-"ldxr %0, [%3];"
-"add %1, %4, %0;"
-"stxr %w2, %1, [%3];"
-"cbnz %w2, 1b;"
-   : "=" (previous),
- "=" (r),
- "=" (tmp)
-   : "r"   (target),
- "r"   (delta)
-   : "memory", "cc");
-
-   return (void *)(previous);
-}
-
-CK_CC_INLINE static uint64_t
-ck_pr_faa_64(uint64_t *target, uint64_t delta)
-{
-uint64_t previous, r, tmp;
-
-__asm__ __volatile__("1:"
- "ldxr %0, [%3];"
- "add %1, %4, %0;"
- "stxr %w2, %1, [%3];"
- "cbnz %w2, 1b;"
-: "=" (previous),
-  "=" (r),
-  "=" (tmp)
-: "r"   (target),
-  "r"   (delta)
-: "memory", "cc");
-
-return (previous);
-}
-
-#define CK_PR_FAA(S, T, W) \
-   CK_CC_INLINE static T   \
-   ck_pr_faa_##S(T *target, T delta)   \
-   {   \
-   T previous, r, tmp; \
-   __asm__ __volatile__("1:"   \
-"ldxr" W " %w0, [%3];" \
-"add %w1, %w4, %w0;"   \
-"stxr" W " %w2, %w1, [%3];"\
-        "cbnz %w2, 1b;"\
-   : "=" (previous), \
- "=" (r),\
- "=" (tmp)   \
-   : "r"   (target),   \
- "r"   (delta) \
-   : "memory", "cc");  \
-   return (previous);  \
-   }
-
-CK_PR_FAA(32, uint32_t, "")
-CK_PR_FAA(uint, unsigned int, "")
-CK_PR_FAA(int, int, "")
-CK_PR_FAA(16, uint16_t, "h")
-CK_PR_FAA(8, uint8_t, "b")
-C

svn commit: r310844 - vendor-sys/ck/20161230

2016-12-30 Thread Olivier Houchard
Author: cognet
Date: Fri Dec 30 18:17:44 2016
New Revision: 310844
URL: https://svnweb.freebsd.org/changeset/base/310844

Log:
  Tag CK import as of commit 255a47553aa5e8d0bb5f8eec63acac7f4c25a6d8

Added:
  vendor-sys/ck/20161230/
 - copied from r310843, vendor-sys/ck/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310843 - in vendor-sys/ck/dist: include include/gcc include/gcc/aarch64 include/gcc/arm include/gcc/ppc64 include/gcc/x86_64 src

2016-12-30 Thread Olivier Houchard
and, S, T, T, "and", W, "w")   \
-   CK_PR_BINARY(add, S, T, T, "add", W, "w")   \
-   CK_PR_BINARY(or, S, T, T, "orr", W, "w")\
-   CK_PR_BINARY(sub, S, T, T, "sub", W, "w")   \
-   CK_PR_BINARY(xor, S, T, T, "eor", W, "w")
-
-CK_PR_BINARY_S(32, uint32_t, "")
-CK_PR_BINARY_S(uint, unsigned int, "")
-CK_PR_BINARY_S(int, int, "")
-CK_PR_BINARY_S(16, uint16_t, "h")
-CK_PR_BINARY_S(8, uint8_t, "b")
-CK_PR_BINARY_S(short, short, "h")
-CK_PR_BINARY_S(char, char, "b")
-
-#undef CK_PR_BINARY_S
-#undef CK_PR_BINARY
-
-CK_CC_INLINE static void *
-ck_pr_faa_ptr(void *target, uintptr_t delta)
-{
-   uintptr_t previous, r, tmp;
-
-   __asm__ __volatile__("1:"
-"ldxr %0, [%3];"
-"add %1, %4, %0;"
-"stxr %w2, %1, [%3];"
-"cbnz %w2, 1b;"
-   : "=" (previous),
- "=" (r),
- "=" (tmp)
-   : "r"   (target),
- "r"   (delta)
-   : "memory", "cc");
-
-   return (void *)(previous);
-}
-
-CK_CC_INLINE static uint64_t
-ck_pr_faa_64(uint64_t *target, uint64_t delta)
-{
-uint64_t previous, r, tmp;
-
-__asm__ __volatile__("1:"
- "ldxr %0, [%3];"
- "add %1, %4, %0;"
- "stxr %w2, %1, [%3];"
- "cbnz %w2, 1b;"
-: "=" (previous),
-  "=" (r),
-  "=" (tmp)
-: "r"   (target),
-  "r"   (delta)
-: "memory", "cc");
-
-return (previous);
-}
-
-#define CK_PR_FAA(S, T, W) \
-   CK_CC_INLINE static T   \
-   ck_pr_faa_##S(T *target, T delta)   \
-   {   \
-   T previous, r, tmp; \
-   __asm__ __volatile__("1:"   \
-"ldxr" W " %w0, [%3];" \
-"add %w1, %w4, %w0;"   \
-"stxr" W " %w2, %w1, [%3];"\
-"cbnz %w2, 1b;"\
-   : "=" (previous), \
- "=" (r),\
- "=" (tmp)   \
-   : "r"   (target),   \
- "r"   (delta) \
-   : "memory", "cc");  \
-   return (previous);  \
-   }
-
-CK_PR_FAA(32, uint32_t, "")
-CK_PR_FAA(uint, unsigned int, "")
-CK_PR_FAA(int, int, "")
-CK_PR_FAA(16, uint16_t, "h")
-CK_PR_FAA(8, uint8_t, "b")
-CK_PR_FAA(short, short, "h")
-CK_PR_FAA(char, char, "b")
+#ifdef CK_MD_LSE_ENABLE
+#include "ck_pr_lse.h"
+#else
+#include "ck_pr_llsc.h"
+#endif
+
+/*
+ * ck_pr_neg_*() functions can only be implemented via LL/SC, as there are no
+ * LSE alternatives.
+ */
+#define CK_PR_NEG(N, M, T, W, R)   \
+CK_CC_INLINE static void   \
+ck_pr_neg_##N(M *target)   \
+{  \
+T previous = 0;\
+T tmp = 0; \
+__asm__ __volatile__("1:"  \
+ "ldxr" W " %" R "0, [%2];"\
+ "neg %" R "0, %" R "0;"   \
+ "stxr" W " %w1, %" R "0, [%2];"   \
+ 

svn commit: r309270 - head/sys/contrib/ck

2016-11-28 Thread Olivier Houchard
Author: cognet
Date: Mon Nov 28 21:16:03 2016
New Revision: 309270
URL: https://svnweb.freebsd.org/changeset/base/309270

Log:
  Add a FREEBSD-Xlist file for CK.

Added:
  head/sys/contrib/ck/FREEBSD-Xlist

Added: head/sys/contrib/ck/FREEBSD-Xlist
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/contrib/ck/FREEBSD-Xlist   Mon Nov 28 21:16:03 2016
(r309270)
@@ -0,0 +1,10 @@
+#$FreeBSD$
+*/LICENSE
+*/Makefile.in
+*/README
+*/build
+*/configure
+*/doc
+*/regressions
+*/tools
+*/include/ck_md.h.in
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r309268 - head/sys/conf

2016-11-28 Thread Olivier Houchard
Author: cognet
Date: Mon Nov 28 20:44:12 2016
New Revision: 309268
URL: https://svnweb.freebsd.org/changeset/base/309268

Log:
  Hook CK to the kernel build.

Modified:
  head/sys/conf/files

Modified: head/sys/conf/files
==
--- head/sys/conf/files Mon Nov 28 20:33:30 2016(r309267)
+++ head/sys/conf/files Mon Nov 28 20:44:12 2016(r309268)
@@ -305,6 +305,17 @@ compat/freebsd32/freebsd32_ioctl.c optio
 compat/freebsd32/freebsd32_misc.c  optional compat_freebsd32
 compat/freebsd32/freebsd32_syscalls.c  optional compat_freebsd32
 compat/freebsd32/freebsd32_sysent.coptional compat_freebsd32
+contrib/ck/src/ck_array.c  standard compile-with 
"${NORMAL_C} -I$S/contrib/ck/include"
+contrib/ck/src/ck_barrier_centralized.cstandard 
compile-with "${NORMAL_C} -I$S/contrib/ck/include"
+contrib/ck/src/ck_barrier_combining.c  standard compile-with 
"${NORMAL_C} -I$S/contrib/ck/include"
+contrib/ck/src/ck_barrier_dissemination.c  standard compile-with 
"${NORMAL_C} -I$S/contrib/ck/include"
+contrib/ck/src/ck_barrier_mcs.cstandard 
compile-with "${NORMAL_C} -I$S/contrib/ck/include"
+contrib/ck/src/ck_barrier_tournament.c standard compile-with 
"${NORMAL_C} -I$S/contrib/ck/include"
+contrib/ck/src/ck_epoch.c  standard compile-with 
"${NORMAL_C} -I$S/contrib/ck/include"
+contrib/ck/src/ck_hp.c standard compile-with 
"${NORMAL_C} -I$S/contrib/ck/include"
+contrib/ck/src/ck_hs.c standard compile-with 
"${NORMAL_C} -I$S/contrib/ck/include"
+contrib/ck/src/ck_ht.c standard compile-with 
"${NORMAL_C} -I$S/contrib/ck/include"
+contrib/ck/src/ck_rhs.cstandard 
compile-with "${NORMAL_C} -I$S/contrib/ck/include"
 contrib/dev/acpica/common/ahids.c  optional acpi acpi_debug
 contrib/dev/acpica/common/ahuuids.coptional acpi acpi_debug
 contrib/dev/acpica/components/debugger/dbcmds.coptional acpi 
acpi_debug
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r309267 - in head/sys/contrib/ck/include: . gcc/arm

2016-11-28 Thread Olivier Houchard
Author: cognet
Date: Mon Nov 28 20:33:30 2016
New Revision: 309267
URL: https://svnweb.freebsd.org/changeset/base/309267

Log:
  Add FreeBSD-specific files.

Added:
  head/sys/contrib/ck/include/ck_md.h   (contents, props changed)
  head/sys/contrib/ck/include/gcc/arm/ck_pr_armv4.h   (contents, props changed)
Modified:
  head/sys/contrib/ck/include/ck_pr.h

Added: head/sys/contrib/ck/include/ck_md.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/contrib/ck/include/ck_md.h Mon Nov 28 20:33:30 2016
(r309267)
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2011-2012 Samy Al Bahra.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef CK_MD_H
+#define CK_MD_H
+
+#ifndef CK_MD_CACHELINE
+#define CK_MD_CACHELINE (64)
+#endif
+
+#ifndef CK_MD_PAGESIZE
+#define CK_MD_PAGESIZE (4096)
+#endif
+
+#ifndef CK_MD_RTM_DISABLE
+#define CK_MD_RTM_DISABLE
+#endif /* CK_MD_RTM_DISABLE */
+
+#ifndef CK_MD_POINTER_PACK_DISABLE
+#define CK_MD_POINTER_PACK_DISABLE
+#endif /* CK_MD_POINTER_PACK_DISABLE */
+
+#ifndef CK_MD_VMA_BITS_UNKNOWN 
+#define CK_MD_VMA_BITS_UNKNOWN 
+#endif /* CK_MD_VMA_BITS_UNKNOWN */
+
+#ifndef CK_MD_RMO
+#define CK_MD_RMO
+#endif /* CK_MD_RMO */
+
+#define CK_VERSION "0.5.2"
+#define CK_GIT_SHA ""
+
+/*
+ * CK expects those, which are normally defined by the build system.
+ */
+#if defined(__i386__) && !defined(__x86__)
+#define __x86__
+#elif defined(__sparc64__) && !defined(__sparcv9__)
+#define __sparcv9__
+#elif defined(__powerpc64__) && !defined(__ppc64__)
+#define __ppc64__
+#elif defined(__powerpc__) && !defined(__ppc__)
+#define __ppc__
+#endif
+#endif /* CK_MD_H */

Modified: head/sys/contrib/ck/include/ck_pr.h
==
--- head/sys/contrib/ck/include/ck_pr.h Mon Nov 28 20:27:58 2016
(r309266)
+++ head/sys/contrib/ck/include/ck_pr.h Mon Nov 28 20:33:30 2016
(r309267)
@@ -46,7 +46,11 @@
 #elif defined(__ppc__)
 #include "gcc/ppc/ck_pr.h"
 #elif defined(__arm__)
+#if __ARM_ARCH >= 6
 #include "gcc/arm/ck_pr.h"
+#else
+#include "gcc/arm/ck_pr_armv4.h"
+#endif
 #elif defined(__aarch64__)
 #include "gcc/aarch64/ck_pr.h"
 #elif !defined(__GNUC__)

Added: head/sys/contrib/ck/include/gcc/arm/ck_pr_armv4.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/contrib/ck/include/gcc/arm/ck_pr_armv4.h   Mon Nov 28 20:33:30 
2016    (r309267)
@@ -0,0 +1,350 @@
+/*
+ * Copyright 2009-2016 Samy Al Bahra.
+ * Copyright 2016 Olivier Houchard.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTA

svn commit: r309264 - in vendor-sys/ck/dist: . build doc include regressions tools

2016-11-28 Thread Olivier Houchard
Author: cognet
Date: Mon Nov 28 20:22:32 2016
New Revision: 309264
URL: https://svnweb.freebsd.org/changeset/base/309264

Log:
  Remove files that won't be used during FreeBSD build.

Deleted:
  vendor-sys/ck/dist/LICENSE
  vendor-sys/ck/dist/Makefile.in
  vendor-sys/ck/dist/README
  vendor-sys/ck/dist/build/
  vendor-sys/ck/dist/configure
  vendor-sys/ck/dist/doc/
  vendor-sys/ck/dist/include/ck_md.h.in
  vendor-sys/ck/dist/regressions/
  vendor-sys/ck/dist/tools/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r309265 - in vendor-sys/ck/20161128: . build doc include regressions tools

2016-11-28 Thread Olivier Houchard
Author: cognet
Date: Mon Nov 28 20:24:09 2016
New Revision: 309265
URL: https://svnweb.freebsd.org/changeset/base/309265

Log:
  Re-tag ck as of commit 566bb28dba963a1904e0889b74fe7005a5bc5eb8

Replaced:
  vendor-sys/ck/20161128/
 - copied from r309260, vendor-sys/ck/dist/
Deleted:
  vendor-sys/ck/20161128/LICENSE
  vendor-sys/ck/20161128/Makefile.in
  vendor-sys/ck/20161128/README
  vendor-sys/ck/20161128/build/
  vendor-sys/ck/20161128/configure
  vendor-sys/ck/20161128/doc/
  vendor-sys/ck/20161128/include/ck_md.h.in
  vendor-sys/ck/20161128/regressions/
  vendor-sys/ck/20161128/tools/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r309266 - head/sys/contrib/ck

2016-11-28 Thread Olivier Houchard
Author: cognet
Date: Mon Nov 28 20:27:58 2016
New Revision: 309266
URL: https://svnweb.freebsd.org/changeset/base/309266

Log:
  Import Concurrency Kit in the kernel.
  CK is a toolkit providing different lockfree algorithms/data structures.
  More information can be found here : www.concurrencykit.org

Added:
  head/sys/contrib/ck/
 - copied from r309265, vendor-sys/ck/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r309261 - vendor-sys/ck/20161128

2016-11-28 Thread Olivier Houchard
Author: cognet
Date: Mon Nov 28 20:11:13 2016
New Revision: 309261
URL: https://svnweb.freebsd.org/changeset/base/309261

Log:
  Tag CK as of commit 566bb28dba963a1904e0889b74fe7005a5bc5eb8

Added:
  vendor-sys/ck/20161128/
 - copied from r309260, vendor-sys/ck/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r309260 - in vendor-sys/ck: . dist dist/build dist/doc dist/include dist/include/gcc dist/include/gcc/aarch64 dist/include/gcc/arm dist/include/gcc/ppc dist/include/gcc/ppc64 dist/inclu...

2016-11-28 Thread Olivier Houchard
Author: cognet
Date: Mon Nov 28 20:08:52 2016
New Revision: 309260
URL: https://svnweb.freebsd.org/changeset/base/309260

Log:
  Import concurrencykit as of commit 566bb28dba963a1904e0889b74fe7005a5bc5eb8

Added:
  vendor-sys/ck/
  vendor-sys/ck/dist/
  vendor-sys/ck/dist/LICENSE
  vendor-sys/ck/dist/Makefile.in   (contents, props changed)
  vendor-sys/ck/dist/README
  vendor-sys/ck/dist/build/
  vendor-sys/ck/dist/build/ck.build.aarch64   (contents, props changed)
  vendor-sys/ck/dist/build/ck.build.arm
  vendor-sys/ck/dist/build/ck.build.in   (contents, props changed)
  vendor-sys/ck/dist/build/ck.build.ppc
  vendor-sys/ck/dist/build/ck.build.ppc64
  vendor-sys/ck/dist/build/ck.build.sparcv9
  vendor-sys/ck/dist/build/ck.build.x86
  vendor-sys/ck/dist/build/ck.build.x86_64
  vendor-sys/ck/dist/build/ck.pc.in   (contents, props changed)
  vendor-sys/ck/dist/build/ck.spec.in   (contents, props changed)
  vendor-sys/ck/dist/build/regressions.build.in   (contents, props changed)
  vendor-sys/ck/dist/configure   (contents, props changed)
  vendor-sys/ck/dist/doc/
  vendor-sys/ck/dist/doc/CK_ARRAY_FOREACH
  vendor-sys/ck/dist/doc/CK_COHORT_INIT
  vendor-sys/ck/dist/doc/CK_COHORT_INSTANCE
  vendor-sys/ck/dist/doc/CK_COHORT_LOCK
  vendor-sys/ck/dist/doc/CK_COHORT_PROTOTYPE
  vendor-sys/ck/dist/doc/CK_COHORT_TRYLOCK
  vendor-sys/ck/dist/doc/CK_COHORT_TRYLOCK_PROTOTYPE
  vendor-sys/ck/dist/doc/CK_COHORT_UNLOCK
  vendor-sys/ck/dist/doc/CK_HS_HASH
  vendor-sys/ck/dist/doc/CK_RHS_HASH
  vendor-sys/ck/dist/doc/CK_RWCOHORT_INIT
  vendor-sys/ck/dist/doc/CK_RWCOHORT_INSTANCE
  vendor-sys/ck/dist/doc/CK_RWCOHORT_PROTOTYPE
  vendor-sys/ck/dist/doc/CK_RWCOHORT_READ_LOCK
  vendor-sys/ck/dist/doc/CK_RWCOHORT_READ_UNLOCK
  vendor-sys/ck/dist/doc/CK_RWCOHORT_WRITE_LOCK
  vendor-sys/ck/dist/doc/CK_RWCOHORT_WRITE_UNLOCK
  vendor-sys/ck/dist/doc/Makefile.in   (contents, props changed)
  vendor-sys/ck/dist/doc/ck_array_buffer
  vendor-sys/ck/dist/doc/ck_array_commit
  vendor-sys/ck/dist/doc/ck_array_deinit
  vendor-sys/ck/dist/doc/ck_array_init
  vendor-sys/ck/dist/doc/ck_array_initialized
  vendor-sys/ck/dist/doc/ck_array_length
  vendor-sys/ck/dist/doc/ck_array_put
  vendor-sys/ck/dist/doc/ck_array_put_unique
  vendor-sys/ck/dist/doc/ck_array_remove
  vendor-sys/ck/dist/doc/ck_bitmap_base
  vendor-sys/ck/dist/doc/ck_bitmap_bits
  vendor-sys/ck/dist/doc/ck_bitmap_bts
  vendor-sys/ck/dist/doc/ck_bitmap_buffer
  vendor-sys/ck/dist/doc/ck_bitmap_clear
  vendor-sys/ck/dist/doc/ck_bitmap_init
  vendor-sys/ck/dist/doc/ck_bitmap_iterator_init
  vendor-sys/ck/dist/doc/ck_bitmap_next
  vendor-sys/ck/dist/doc/ck_bitmap_reset
  vendor-sys/ck/dist/doc/ck_bitmap_set
  vendor-sys/ck/dist/doc/ck_bitmap_size
  vendor-sys/ck/dist/doc/ck_bitmap_test
  vendor-sys/ck/dist/doc/ck_bitmap_union
  vendor-sys/ck/dist/doc/ck_brlock
  vendor-sys/ck/dist/doc/ck_cohort
  vendor-sys/ck/dist/doc/ck_elide
  vendor-sys/ck/dist/doc/ck_epoch_barrier
  vendor-sys/ck/dist/doc/ck_epoch_begin
  vendor-sys/ck/dist/doc/ck_epoch_call
  vendor-sys/ck/dist/doc/ck_epoch_end
  vendor-sys/ck/dist/doc/ck_epoch_init
  vendor-sys/ck/dist/doc/ck_epoch_poll
  vendor-sys/ck/dist/doc/ck_epoch_reclaim
  vendor-sys/ck/dist/doc/ck_epoch_recycle
  vendor-sys/ck/dist/doc/ck_epoch_register
  vendor-sys/ck/dist/doc/ck_epoch_synchronize
  vendor-sys/ck/dist/doc/ck_epoch_unregister
  vendor-sys/ck/dist/doc/ck_hs_apply
  vendor-sys/ck/dist/doc/ck_hs_count
  vendor-sys/ck/dist/doc/ck_hs_destroy
  vendor-sys/ck/dist/doc/ck_hs_fas
  vendor-sys/ck/dist/doc/ck_hs_gc
  vendor-sys/ck/dist/doc/ck_hs_get
  vendor-sys/ck/dist/doc/ck_hs_grow
  vendor-sys/ck/dist/doc/ck_hs_init
  vendor-sys/ck/dist/doc/ck_hs_iterator_init
  vendor-sys/ck/dist/doc/ck_hs_move
  vendor-sys/ck/dist/doc/ck_hs_next
  vendor-sys/ck/dist/doc/ck_hs_put
  vendor-sys/ck/dist/doc/ck_hs_put_unique
  vendor-sys/ck/dist/doc/ck_hs_rebuild
  vendor-sys/ck/dist/doc/ck_hs_remove
  vendor-sys/ck/dist/doc/ck_hs_reset
  vendor-sys/ck/dist/doc/ck_hs_reset_size
  vendor-sys/ck/dist/doc/ck_hs_set
  vendor-sys/ck/dist/doc/ck_hs_stat
  vendor-sys/ck/dist/doc/ck_ht_count
  vendor-sys/ck/dist/doc/ck_ht_destroy
  vendor-sys/ck/dist/doc/ck_ht_entry_empty
  vendor-sys/ck/dist/doc/ck_ht_entry_key
  vendor-sys/ck/dist/doc/ck_ht_entry_key_direct
  vendor-sys/ck/dist/doc/ck_ht_entry_key_length
  vendor-sys/ck/dist/doc/ck_ht_entry_key_set
  vendor-sys/ck/dist/doc/ck_ht_entry_key_set_direct
  vendor-sys/ck/dist/doc/ck_ht_entry_set
  vendor-sys/ck/dist/doc/ck_ht_entry_set_direct
  vendor-sys/ck/dist/doc/ck_ht_entry_value
  vendor-sys/ck/dist/doc/ck_ht_entry_value_direct
  vendor-sys/ck/dist/doc/ck_ht_gc
  vendor-sys/ck/dist/doc/ck_ht_get_spmc
  vendor-sys/ck/dist/doc/ck_ht_grow_spmc
  vendor-sys/ck/dist/doc/ck_ht_hash
  vendor-sys/ck/dist/doc/ck_ht_hash_direct
  vendor-sys/ck/dist/doc/ck_ht_init
  vendor-sys/ck/dist/doc/ck_ht_iterator_init
  vendor-sys/ck/dist/doc/ck_ht_next
  vendor-sys/ck/dist/doc/ck_ht_put_spmc
  vendor-sys/ck/dist/doc/ck_ht_remove_spmc
  

svn commit: r308840 - in head/sys/arm/ti: . am335x omap4

2016-11-19 Thread Olivier Houchard
Author: cognet
Date: Sat Nov 19 15:43:22 2016
New Revision: 308840
URL: https://svnweb.freebsd.org/changeset/base/308840

Log:
  The only remaining offender that used ti_chip() without checking for
  compatibility first was the gpio code, so change that, and re-assert
  that the TI chip is a known chip

Modified:
  head/sys/arm/ti/am335x/am335x_gpio.c
  head/sys/arm/ti/omap4/omap4_gpio.c
  head/sys/arm/ti/ti_cpuid.h

Modified: head/sys/arm/ti/am335x/am335x_gpio.c
==
--- head/sys/arm/ti/am335x/am335x_gpio.cSat Nov 19 15:38:13 2016
(r308839)
+++ head/sys/arm/ti/am335x/am335x_gpio.cSat Nov 19 15:43:22 2016
(r308840)
@@ -65,8 +65,6 @@ static struct ofw_compat_data compat_dat
 static int
 am335x_gpio_probe(device_t dev)
 {
-   if (ti_chip() != CHIP_AM335X)
-   return (ENXIO);
 
if (!ofw_bus_status_okay(dev))
return (ENXIO);
@@ -74,6 +72,9 @@ am335x_gpio_probe(device_t dev)
if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
return (ENXIO);
 
+   if (ti_chip() != CHIP_AM335X)
+   return (ENXIO);
+
device_set_desc(dev, "TI AM335x General Purpose I/O (GPIO)");
 
return (0);

Modified: head/sys/arm/ti/omap4/omap4_gpio.c
==
--- head/sys/arm/ti/omap4/omap4_gpio.c  Sat Nov 19 15:38:13 2016
(r308839)
+++ head/sys/arm/ti/omap4/omap4_gpio.c  Sat Nov 19 15:43:22 2016
(r308840)
@@ -59,14 +59,14 @@ static struct ofw_compat_data compat_dat
 static int
 omap4_gpio_probe(device_t dev)
 {
-   if (ti_chip() != CHIP_OMAP_4)
-   return (ENXIO);
 
if (!ofw_bus_status_okay(dev))
return (ENXIO);
 
if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
return (ENXIO);
+   if (ti_chip() != CHIP_OMAP_4)
+   return (ENXIO);
 
device_set_desc(dev, "TI OMAP4 General Purpose I/O (GPIO)");
 

Modified: head/sys/arm/ti/ti_cpuid.h
==
--- head/sys/arm/ti/ti_cpuid.h  Sat Nov 19 15:38:13 2016(r308839)
+++ head/sys/arm/ti/ti_cpuid.h  Sat Nov 19 15:43:22 2016(r308840)
@@ -74,6 +74,7 @@ extern int _ti_chip;
 
 static __inline int ti_chip(void)
 {
+   KASSERT(_ti_chip != -1, ("Can't determine TI Chip"));
return _ti_chip;
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308837 - head/sys/arm/ti

2016-11-19 Thread Olivier Houchard
Author: cognet
Date: Sat Nov 19 15:35:40 2016
New Revision: 308837
URL: https://svnweb.freebsd.org/changeset/base/308837

Log:
  Don't panic if it's not a TI chip, this code can be called when it is not.

Modified:
  head/sys/arm/ti/ti_cpuid.h

Modified: head/sys/arm/ti/ti_cpuid.h
==
--- head/sys/arm/ti/ti_cpuid.h  Sat Nov 19 15:35:10 2016(r308836)
+++ head/sys/arm/ti/ti_cpuid.h  Sat Nov 19 15:35:40 2016(r308837)
@@ -74,7 +74,6 @@ extern int _ti_chip;
 
 static __inline int ti_chip(void)
 {
-   KASSERT(_ti_chip != -1, ("Can't determine TI Chip"));
return _ti_chip;
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308836 - head/sys/arm/ti

2016-11-19 Thread Olivier Houchard
Author: cognet
Date: Sat Nov 19 15:35:10 2016
New Revision: 308836
URL: https://svnweb.freebsd.org/changeset/base/308836

Log:
  Don't attempt to get the chip revision if it's not a supported TI chip

Modified:
  head/sys/arm/ti/ti_cpuid.c

Modified: head/sys/arm/ti/ti_cpuid.c
==
--- head/sys/arm/ti/ti_cpuid.c  Sat Nov 19 15:10:10 2016(r308835)
+++ head/sys/arm/ti/ti_cpuid.c  Sat Nov 19 15:35:10 2016(r308836)
@@ -43,6 +43,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+#include 
+#include 
+
 #include 
 #include 
 
@@ -268,6 +272,12 @@ am335x_get_revision(void)
 static void
 ti_cpu_ident(void *dummy)
 {
+   phandle_t root;
+
+   root = OF_finddevice("/");
+   if (!ofw_bus_node_is_compatible(root, "ti,omap4") &&
+   !ofw_bus_node_is_compatible(root, "ti,am33xx"))
+   return;
switch(ti_chip()) {
case CHIP_OMAP_4:
omap4_get_revision();
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308828 - head/sys/arm/ti/usb

2016-11-19 Thread Olivier Houchard
Author: cognet
Date: Sat Nov 19 13:11:03 2016
New Revision: 308828
URL: https://svnweb.freebsd.org/changeset/base/308828

Log:
  Move the pandaboard initialization from the probe to the attach method.
  Use ofw_bus_node_is_compatible instead of fdt_is_compatible, as the
  later is deprecated.
  
  Suggested by: andrew

Modified:
  head/sys/arm/ti/usb/omap_ehci.c

Modified: head/sys/arm/ti/usb/omap_ehci.c
==
--- head/sys/arm/ti/usb/omap_ehci.c Sat Nov 19 08:54:21 2016
(r308827)
+++ head/sys/arm/ti/usb/omap_ehci.c Sat Nov 19 13:11:03 2016
(r308828)
@@ -261,24 +261,12 @@ omap_ehci_init(struct omap_ehci_softc *i
 static int
 omap_ehci_probe(device_t dev)
 {
-   phandle_t root;
-
if (!ofw_bus_status_okay(dev))
return (ENXIO);
 
if (!ofw_bus_is_compatible(dev, "ti,ehci-omap"))
return (ENXIO);
 
-#ifdef SOC_OMAP4
-   /* 
-* If we're running a Pandaboard, run Pandaboard-specific 
-* init code.
-*/
-   root = OF_finddevice("/");
-   if (fdt_is_compatible(root, "ti,omap4-panda"))
-   pandaboard_usb_hub_init();
-#endif
-
device_set_desc(dev, OMAP_EHCI_HC_DEVSTR);

return (BUS_PROBE_DEFAULT);
@@ -303,9 +291,22 @@ omap_ehci_attach(device_t dev)
 {
struct omap_ehci_softc *isc = device_get_softc(dev);
ehci_softc_t *sc = >base;
+#ifdef SOC_OMAP4
+   phandle_t root;
+#endif
int err;
int rid;
 
+#ifdef SOC_OMAP4
+   /* 
+* If we're running a Pandaboard, run Pandaboard-specific 
+* init code.
+*/
+   root = OF_finddevice("/");
+   if (ofw_bus_node_is_compatible(root, "ti,omap4-panda"))
+   pandaboard_usb_hub_init();
+#endif
+
/* initialise some bus fields */
sc->sc_bus.parent = dev;
sc->sc_bus.devices = sc->sc_devices;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308822 - in head/sys/arm: conf ti ti/am335x ti/omap4

2016-11-18 Thread Olivier Houchard
Author: cognet
Date: Sat Nov 19 01:51:56 2016
New Revision: 308822
URL: https://svnweb.freebsd.org/changeset/base/308822

Log:
  Resolv the remaining conflicting symbols between omap4 and am335x, and
  add omap4/pandaboard into the GENERIC kernel.

Modified:
  head/sys/arm/conf/GENERIC
  head/sys/arm/ti/am335x/am335x_scm_padconf.c
  head/sys/arm/ti/am335x/am335x_scm_padconf.h
  head/sys/arm/ti/omap4/omap4_scm_padconf.c
  head/sys/arm/ti/omap4/omap4_scm_padconf.h
  head/sys/arm/ti/ti_machdep.c
  head/sys/arm/ti/ti_pinmux.c

Modified: head/sys/arm/conf/GENERIC
==
--- head/sys/arm/conf/GENERIC   Sat Nov 19 01:36:44 2016(r308821)
+++ head/sys/arm/conf/GENERIC   Sat Nov 19 01:51:56 2016(r308822)
@@ -43,6 +43,7 @@ files "../nvidia/tegra124/files.tegra12
 files  "../qemu/files.qemu"
 files  "../ti/files.ti"
 files  "../ti/am335x/files.am335x"
+files  "../ti/omap4/files.omap4"
 
 optionsSOC_ALLWINNER_A10
 optionsSOC_ALLWINNER_A13
@@ -53,6 +54,7 @@ options   SOC_ALLWINNER_A83T
 optionsSOC_ALLWINNER_H3
 optionsSOC_BCM2836
 optionsSOC_TI_AM335X
+optionsSOC_OMAP4
 
 optionsSCHED_ULE   # ULE scheduler
 optionsSMP # Enable multiple cores
@@ -80,6 +82,7 @@ devicepmu
 
 # ARM Generic Timer
 device generic_timer
+device mpcore_timer
 
 # MMC/SD/SDIO Card slot support
 device sdhci   # SD controller
@@ -129,6 +132,9 @@ device  ti_i2c
 device am335x_pmic # AM335x Power Management IC (TPC65217)
 device am335x_rtc  # RTC support (power management only)
 #defineam335x_dmtpps   # Pulse Per Second capture driver
+device twl # TI TWLX0X0/TPS659x0 Power Management
+device twl_vreg# twl voltage regulation
+device twl_clks# twl external clocks
 
 # GPIO
 device gpio
@@ -214,9 +220,12 @@ device ti_pruss
 # Mailbox support
 device ti_mbox
 
+# DMA controller
+device ti_sdma
+
 # Extensible Firmware Interface
 optionsEFI
 
 # Flattened Device Tree
 optionsFDT # Configure using FDT/DTB data
-makeoptionsMODULES_EXTRA="dtb/allwinner dtb/am335x dtb/nvidia dtb/rpi"
+makeoptionsMODULES_EXTRA="dtb/allwinner dtb/am335x dtb/nvidia dtb/rpi 
dtb/omap4"

Modified: head/sys/arm/ti/am335x/am335x_scm_padconf.c
==
--- head/sys/arm/ti/am335x/am335x_scm_padconf.c Sat Nov 19 01:36:44 2016
(r308821)
+++ head/sys/arm/ti/am335x/am335x_scm_padconf.c Sat Nov 19 01:51:56 2016
(r308822)
@@ -293,7 +293,7 @@ const static struct ti_pinmux_padconf ti
{  .ballname = NULL  },
 };
 
-const struct ti_pinmux_device ti_pinmux_dev = {
+const struct ti_pinmux_device ti_am335x_pinmux_dev = {
.padconf_muxmode_mask   = 0x7,
.padconf_sate_mask  = 0x78,
.padstate   = ti_padstate_devmap,

Modified: head/sys/arm/ti/am335x/am335x_scm_padconf.h
==
--- head/sys/arm/ti/am335x/am335x_scm_padconf.h Sat Nov 19 01:36:44 2016
(r308821)
+++ head/sys/arm/ti/am335x/am335x_scm_padconf.h Sat Nov 19 01:51:56 2016
(r308822)
@@ -42,4 +42,6 @@
 #define PADCONF_INPUT_PULLDOWN (RXACTIVE)
 #define PADCONF_INPUT_PULLUP_SLOW  (PADCONF_INPUT_PULLUP | SLEWCTRL)
 
+extern const struct ti_pinmux_device ti_am335x_pinmux_dev;
+
 #endif /* AM335X_SCM_PADCONF_H */

Modified: head/sys/arm/ti/omap4/omap4_scm_padconf.c
==
--- head/sys/arm/ti/omap4/omap4_scm_padconf.c   Sat Nov 19 01:36:44 2016
(r308821)
+++ head/sys/arm/ti/omap4/omap4_scm_padconf.c   Sat Nov 19 01:51:56 2016
(r308822)
@@ -295,7 +295,7 @@ const static struct ti_pinmux_padconf ti
{  .ballname = NULL  },
 };
 
-const struct ti_pinmux_device ti_pinmux_dev = {
+const struct ti_pinmux_device omap4_pinmux_dev = {
.padconf_muxmode_mask   = CONTROL_PADCONF_MUXMODE_MASK,
.padconf_sate_mask  = CONTROL_PADCONF_SATE_MASK,
.padstate   = ti_padstate_devmap,

Modified: head/sys/arm/ti/omap4/omap4_scm_padconf.h
==
--- head/sys/arm/ti/omap4/omap4_scm_padconf.h   Sat Nov 19 01:36:44 2016
(r308821)
+++ head/sys/arm/ti/omap4/omap4_scm_padconf.h   Sat Nov 19 01:51:56 2016
(r308822)
@@ -78,4 +78,6 @@
 | CONTROL_PADCONF_OFF_PULL_ENABLE)
 #define PADCONF_PIN_OFF_WAKEUPENABLE   CONTROL_PADCONF_WAKEUP_ENABLE
 
+extern const struct ti_pinmux_device 

svn commit: r308819 - in head/sys/arm: conf ti/omap4 ti/omap4/pandaboard ti/usb

2016-11-18 Thread Olivier Houchard
Author: cognet
Date: Sat Nov 19 00:55:46 2016
New Revision: 308819
URL: https://svnweb.freebsd.org/changeset/base/308819

Log:
  Don't assume we're running on a pandaboard if the pandaboard-specific
  code is compiled in, use FDT to detect it instead.

Added:
  head/sys/arm/ti/omap4/pandaboard/pandaboard.h   (contents, props changed)
Deleted:
  head/sys/arm/ti/omap4/pandaboard/files.pandaboard
  head/sys/arm/ti/omap4/pandaboard/std.pandaboard
Modified:
  head/sys/arm/conf/PANDABOARD
  head/sys/arm/ti/omap4/files.omap4
  head/sys/arm/ti/omap4/pandaboard/pandaboard.c
  head/sys/arm/ti/usb/omap_ehci.c

Modified: head/sys/arm/conf/PANDABOARD
==
--- head/sys/arm/conf/PANDABOARDFri Nov 18 23:48:20 2016
(r308818)
+++ head/sys/arm/conf/PANDABOARDSat Nov 19 00:55:46 2016
(r308819)
@@ -28,7 +28,7 @@ ident PANDABOARD
 hints  "PANDABOARD.hints"
 
 include"std.armv6"
-include"../ti/omap4/pandaboard/std.pandaboard"
+include"../ti/omap4/std.omap4"
 
 makeoptionsMODULES_EXTRA=dtb/omap4
 

Modified: head/sys/arm/ti/omap4/files.omap4
==
--- head/sys/arm/ti/omap4/files.omap4   Fri Nov 18 23:48:20 2016
(r308818)
+++ head/sys/arm/ti/omap4/files.omap4   Sat Nov 19 00:55:46 2016
(r308819)
@@ -14,6 +14,8 @@ arm/ti/omap4/omap4_scm_padconf.c  standa
 arm/ti/omap4/omap4_mp.coptionalsmp
 arm/ti/omap4/omap4_wugen.c standard
 
+arm/ti/omap4/pandaboard/pandaboard.c   standard
+
 arm/ti/twl/twl.c   optionaltwl
 arm/ti/twl/twl_vreg.c  optionaltwl twl_vreg
 arm/ti/twl/twl_clks.c  optionaltwl twl_clks

Modified: head/sys/arm/ti/omap4/pandaboard/pandaboard.c
==
--- head/sys/arm/ti/omap4/pandaboard/pandaboard.c   Fri Nov 18 23:48:20 
2016(r308818)
+++ head/sys/arm/ti/omap4/pandaboard/pandaboard.c   Sat Nov 19 00:55:46 
2016(r308819)
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 
 /* Registers in the SCRM that control the AUX clocks */
 #define SCRM_ALTCLKSRC  (0x110)
@@ -111,8 +112,8 @@ __FBSDID("$FreeBSD$");
  * RETURNS:
  * nothing.
  */
-static void
-usb_hub_init(void)
+void
+pandaboard_usb_hub_init(void)
 {
bus_space_handle_t scrm_addr, gpio1_addr, gpio2_addr, scm_addr;
 
@@ -169,39 +170,3 @@ usb_hub_init(void)
bus_space_unmap(fdtbus_bs_tag, gpio2_addr, OMAP44XX_GPIO2_SIZE);
bus_space_unmap(fdtbus_bs_tag, scm_addr, OMAP44XX_SCM_PADCONF_SIZE);
 }
-
-/**
- * board_init - initialises the pandaboard
- * @dummy: ignored
- * 
- * This function is called before any of the driver are initialised, which 
is
- * annoying because it means we can't use the SCM, PRCM and GPIO modules 
which
- * would really be useful.
- *
- * So we don't have:
- *- any drivers
- *- no interrupts
- *
- * What we do have:
- *- virt/phys mappings from the devmap (see omap4.c)
- *- 
- *
- *
- * So we are hamstrung without the useful drivers and we have to go back to
- * direct register manupulation. Luckly we don't have to do to much, 
basically
- * just setup the usb hub/ethernet.
- *
- */
-static void
-board_init(void *dummy)
-{
-   /* Initialise the USB phy and hub */
-   usb_hub_init();
-   
-   /*
-* XXX Board identification e.g. read out from FPGA or similar should
-* go here
-*/
-}
-
-SYSINIT(board_init, SI_SUB_CPU, SI_ORDER_THIRD, board_init, NULL);

Added: head/sys/arm/ti/omap4/pandaboard/pandaboard.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/ti/omap4/pandaboard/pandaboard.h   Sat Nov 19 00:55:46 
2016    (r308819)
@@ -0,0 +1,32 @@
+/*-
+ * Copyright (c) 2016 Olivier Houchard <cog...@freebsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIM

svn commit: r308818 - head/sys/arm/ti

2016-11-18 Thread Olivier Houchard
Author: cognet
Date: Fri Nov 18 23:48:20 2016
New Revision: 308818
URL: https://svnweb.freebsd.org/changeset/base/308818

Log:
  Guess the TI chip based on the PLATFORM infos, instead of relying on the
  kernel config file.

Modified:
  head/sys/arm/ti/ti_cpuid.h
  head/sys/arm/ti/ti_machdep.c

Modified: head/sys/arm/ti/ti_cpuid.h
==
--- head/sys/arm/ti/ti_cpuid.h  Fri Nov 18 22:59:33 2016(r308817)
+++ head/sys/arm/ti/ti_cpuid.h  Fri Nov 18 23:48:20 2016(r308818)
@@ -70,15 +70,12 @@
 #defineCHIP_OMAP_4 0
 #defineCHIP_AM335X 1
 
+extern int _ti_chip;
+
 static __inline int ti_chip(void)
 {
-#if defined(SOC_OMAP4)
-   return CHIP_OMAP_4;
-#elif defined(SOC_TI_AM335X)
-   return CHIP_AM335X;
-#else
-#  error Chip type not defined, ensure SOC_ is defined
-#endif
+   KASSERT(_ti_chip != -1, ("Can't determine TI Chip"));
+   return _ti_chip;
 }
 
 uint32_t ti_revision(void);

Modified: head/sys/arm/ti/ti_machdep.c
==
--- head/sys/arm/ti/ti_machdep.cFri Nov 18 22:59:33 2016
(r308817)
+++ head/sys/arm/ti/ti_machdep.cFri Nov 18 23:48:20 2016
(r308818)
@@ -54,11 +54,32 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 
 #include "platform_if.h"
 
 void (*ti_cpu_reset)(void) = NULL;
 
+int _ti_chip = -1;
+
+#if defined(SOC_OMAP4)
+static int
+omap4_attach(platform_t plat)
+{
+   _ti_chip = CHIP_OMAP_4;
+   return (0);
+}
+#endif
+
+#if defined(SOC_TI_AM335X)
+static int
+ti_am335x_attach(platform_t plat)
+{
+   _ti_chip = CHIP_AM335X;
+   return (0);
+}
+#endif
+
 static vm_offset_t
 ti_lastaddr(platform_t plat)
 {
@@ -107,6 +128,7 @@ ti_plat_cpu_reset(platform_t plat)
 
 #if defined(SOC_OMAP4)
 static platform_method_t omap4_methods[] = {
+   PLATFORMMETHOD(platform_attach, omap4_attach),
PLATFORMMETHOD(platform_devmap_init,ti_omap4_devmap_init),
PLATFORMMETHOD(platform_lastaddr,   ti_lastaddr),
PLATFORMMETHOD(platform_cpu_reset,  ti_plat_cpu_reset),
@@ -122,6 +144,7 @@ FDT_PLATFORM_DEF(omap4, "omap4", 0, "ti,
 
 #if defined(SOC_TI_AM335X)
 static platform_method_t am335x_methods[] = {
+   PLATFORMMETHOD(platform_attach, ti_am335x_attach),
PLATFORMMETHOD(platform_devmap_init,ti_am335x_devmap_init),
PLATFORMMETHOD(platform_lastaddr,   ti_lastaddr),
PLATFORMMETHOD(platform_cpu_reset,  ti_plat_cpu_reset),
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308816 - in head/sys/arm: conf ti ti/omap4

2016-11-18 Thread Olivier Houchard
Author: cognet
Date: Fri Nov 18 22:58:47 2016
New Revision: 308816
URL: https://svnweb.freebsd.org/changeset/base/308816

Log:
  Convert the omap4 code to use PLATFORM_SMP.

Added:
  head/sys/arm/ti/omap4/omap4_mp.h   (contents, props changed)
Modified:
  head/sys/arm/conf/PANDABOARD
  head/sys/arm/ti/omap4/omap4_mp.c
  head/sys/arm/ti/ti_machdep.c

Modified: head/sys/arm/conf/PANDABOARD
==
--- head/sys/arm/conf/PANDABOARDFri Nov 18 22:28:57 2016
(r308815)
+++ head/sys/arm/conf/PANDABOARDFri Nov 18 22:58:47 2016
(r308816)
@@ -34,6 +34,7 @@ makeoptions   MODULES_EXTRA=dtb/omap4
 
 optionsSCHED_ULE   # ULE scheduler
 optionsPLATFORM
+optionsPLATFORM_SMP
 optionsSMP # Enable multiple cores
 
 # NFS root from boopt/dhcp

Modified: head/sys/arm/ti/omap4/omap4_mp.c
==
--- head/sys/arm/ti/omap4/omap4_mp.cFri Nov 18 22:28:57 2016
(r308815)
+++ head/sys/arm/ti/omap4/omap4_mp.cFri Nov 18 22:58:47 2016
(r308816)
@@ -38,20 +38,24 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
+#include 
 
 void
-platform_mp_setmaxid(void)
+omap4_mp_setmaxid(platform_t plat)
 {
 
+   if (mp_ncpus != 0)
+   return;
mp_maxid = 1;
mp_ncpus = 2;
 }
 
 void
-platform_mp_start_ap(void)
+omap4_mp_start_ap(platform_t plat)
 {
bus_addr_t scu_addr;
 

Added: head/sys/arm/ti/omap4/omap4_mp.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/ti/omap4/omap4_mp.hFri Nov 18 22:58:47 2016
(r308816)
@@ -0,0 +1,33 @@
+/*-
+ * Copyright (c) 2016 Olivier Houchard <cog...@freebsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _OMAP4_MP_H_
+#define _OMAP4_MP_H_
+void omap4_mp_setmaxid(platform_t plat);
+void omap4_mp_start_ap(platform_t plat);
+#endif /* _OMAP4_MP_H_ */
+

Modified: head/sys/arm/ti/ti_machdep.c
==
--- head/sys/arm/ti/ti_machdep.cFri Nov 18 22:28:57 2016
(r308815)
+++ head/sys/arm/ti/ti_machdep.cFri Nov 18 22:58:47 2016
(r308816)
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 
 #include "platform_if.h"
 
@@ -110,6 +111,10 @@ static platform_method_t omap4_methods[]
PLATFORMMETHOD(platform_lastaddr,   ti_lastaddr),
PLATFORMMETHOD(platform_cpu_reset,  ti_plat_cpu_reset),
 
+#ifdef SMP
+   PLATFORMMETHOD(platform_mp_start_ap,omap4_mp_start_ap),
+   PLATFORMMETHOD(platform_mp_setmaxid,omap4_mp_setmaxid),
+#endif
PLATFORMMETHOD_END,
 };
 FDT_PLATFORM_DEF(omap4, "omap4", 0, "ti,omap4430", 0);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305097 - head/sys/arm/xscale/i8134x

2016-08-30 Thread Olivier Houchard
Author: cognet
Date: Tue Aug 30 23:32:38 2016
New Revision: 305097
URL: https://svnweb.freebsd.org/changeset/base/305097

Log:
  Nuke obio_bs_tag, it was used before it was initialized, and
  arm_base_bs_tag is the same, anyway.

Modified:
  head/sys/arm/xscale/i8134x/crb_machdep.c
  head/sys/arm/xscale/i8134x/obio.c
  head/sys/arm/xscale/i8134x/obiovar.h
  head/sys/arm/xscale/i8134x/uart_cpu_i81342.c

Modified: head/sys/arm/xscale/i8134x/crb_machdep.c
==
--- head/sys/arm/xscale/i8134x/crb_machdep.cTue Aug 30 23:30:26 2016
(r305096)
+++ head/sys/arm/xscale/i8134x/crb_machdep.cTue Aug 30 23:32:38 2016
(r305097)
@@ -286,7 +286,7 @@ initarm(struct arm_boot_params *abp)
cpu_setup();
 
i80321_calibrate_delay();
-   i81342_sdram_bounds(obio_bs_tag, IOP34X_VADDR, , );
+   i81342_sdram_bounds(arm_base_bs_tag, IOP34X_VADDR, , );
physmem = memsize / PAGE_SIZE;
cninit();
/* Set stack for exception handlers */

Modified: head/sys/arm/xscale/i8134x/obio.c
==
--- head/sys/arm/xscale/i8134x/obio.c   Tue Aug 30 23:30:26 2016
(r305096)
+++ head/sys/arm/xscale/i8134x/obio.c   Tue Aug 30 23:32:38 2016
(r305097)
@@ -56,8 +56,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-bus_space_tag_t obio_bs_tag;
-
 static int
 obio_probe(device_t dev)
 {
@@ -69,8 +67,7 @@ obio_attach(device_t dev)
 {
struct obio_softc *sc = device_get_softc(dev);
 
-   obio_bs_tag = arm_base_bs_tag;
-   sc->oba_st = obio_bs_tag;
+   sc->oba_st = arm_base_bs_tag;
sc->oba_rman.rm_type = RMAN_ARRAY;
sc->oba_rman.rm_descr = "OBIO I/O";
if (rman_init(>oba_rman) != 0 ||

Modified: head/sys/arm/xscale/i8134x/obiovar.h
==
--- head/sys/arm/xscale/i8134x/obiovar.hTue Aug 30 23:30:26 2016
(r305096)
+++ head/sys/arm/xscale/i8134x/obiovar.hTue Aug 30 23:32:38 2016
(r305097)
@@ -50,6 +50,5 @@ struct obio_softc {
struct rman oba_irq_rman;

 };
-extern bus_space_tag_t obio_bs_tag;
 
 #endif /* _IQ80321_OBIOVAR_H_ */

Modified: head/sys/arm/xscale/i8134x/uart_cpu_i81342.c
==
--- head/sys/arm/xscale/i8134x/uart_cpu_i81342.cTue Aug 30 23:30:26 
2016(r305096)
+++ head/sys/arm/xscale/i8134x/uart_cpu_i81342.cTue Aug 30 23:32:38 
2016(r305097)
@@ -54,14 +54,14 @@ uart_cpu_getdev(int devtype, struct uart
 
di->ops = uart_getops(_ns8250_class);
di->bas.chan = 0;
-   di->bas.bst = obio_bs_tag;
+   di->bas.bst = arm_base_bs_tag;
di->bas.regshft = 2;
di->bas.rclk = 4000;
di->baudrate = 115200;
di->databits = 8;
di->stopbits = 1;
di->parity = UART_PARITY_NONE;
-   uart_bus_space_io = obio_bs_tag;
+   uart_bus_space_io = arm_base_bs_tag;
uart_bus_space_mem = NULL;
di->bas.bsh = IOP34X_UART0_VADDR;
return (0);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305096 - head/sys/arm/arm

2016-08-30 Thread Olivier Houchard
Author: cognet
Date: Tue Aug 30 23:30:26 2016
New Revision: 305096
URL: https://svnweb.freebsd.org/changeset/base/305096

Log:
  Some old arm ports don't load the kernel at the beginning of the memory,
  because the bootloader, ie redboot, won't let them do so, and so used the
  memory before the kernel for early memory allocation, such as pagetables,
  stacks, etc...
  Make a bit of an effort to try to get that memory mapped.

Modified:
  head/sys/arm/arm/locore-v4.S

Modified: head/sys/arm/arm/locore-v4.S
==
--- head/sys/arm/arm/locore-v4.STue Aug 30 22:48:05 2016
(r305095)
+++ head/sys/arm/arm/locore-v4.STue Aug 30 23:30:26 2016
(r305096)
@@ -195,6 +195,16 @@ Lunmapped:
ldr r2, =(KERNVIRTADDR)
mov r3, #64
bl  build_pagetables
+#if defined(PHYSADDR) && (KERNVIRTADDR != KERNBASE)
+/* 
+ * If the kernel wasn't loaded at the beginning of the ram, map the memory
+ * before the kernel too, as some ports use that for pagetables, stack, etc...
+ */
+   ldr r1, =PHYSADDR
+   ldr r2, =KERNBASE
+   ldr r3, =((KERNVIRTADDR - KERNBASE) / L1_S_SIZE)
+   bl  build_pagetables
+#endif
 
/* Create a device mapping for early_printf if specified. */
 #if defined(SOCDEV_PA) && defined(SOCDEV_VA)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305094 - head/sys/arm/arm

2016-08-30 Thread Olivier Houchard
Author: cognet
Date: Tue Aug 30 22:32:33 2016
New Revision: 305094
URL: https://svnweb.freebsd.org/changeset/base/305094

Log:
  Garbage collect bits forgotten in r295267.

Modified:
  head/sys/arm/arm/cpufunc_asm_xscale_c3.S

Modified: head/sys/arm/arm/cpufunc_asm_xscale_c3.S
==
--- head/sys/arm/arm/cpufunc_asm_xscale_c3.STue Aug 30 21:53:22 2016
(r305093)
+++ head/sys/arm/arm/cpufunc_asm_xscale_c3.STue Aug 30 22:32:33 2016
(r305094)
@@ -364,8 +364,6 @@ ENTRY(xscalec3_setttb)
 
 #ifdef CACHE_CLEAN_BLOCK_INTR
msr cpsr_fsxc, r3
-#else
-   str r2, [r3]
 #endif
RET
 END(xscalec3_setttb)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r297189 - svnadmin/conf

2016-03-22 Thread Olivier Houchard
Author: cognet
Date: Tue Mar 22 13:32:34 2016
New Revision: 297189
URL: https://svnweb.freebsd.org/changeset/base/297189

Log:
  Release wma from mentorship.

Modified:
  svnadmin/conf/mentors

Modified: svnadmin/conf/mentors
==
--- svnadmin/conf/mentors   Tue Mar 22 13:16:52 2016(r297188)
+++ svnadmin/conf/mentors   Tue Mar 22 13:32:34 2016(r297189)
@@ -35,4 +35,3 @@ lidl  rpaulo  Co-mentor: adrian
 torek  rpaulo
 venkat delphij Co-mentor: luigi, jhb
 versus gavin   Co-mentor: fjoe
-wmacognet
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r294409 - svnadmin/conf

2016-01-20 Thread Olivier Houchard
Author: cognet
Date: Wed Jan 20 10:12:06 2016
New Revision: 294409
URL: https://svnweb.freebsd.org/changeset/base/294409

Log:
  Add wma (Wojciech Macek) as a src committer.
  Wojciech has been doing many work on arm/arm64, and will now be able to commit
  it by himself.
  As this commit suggests, I'll be is mentor.
  
  Approved by:  core

Modified:
  svnadmin/conf/access
  svnadmin/conf/mentors

Modified: svnadmin/conf/access
==
--- svnadmin/conf/accessWed Jan 20 09:50:54 2016(r294408)
+++ svnadmin/conf/accessWed Jan 20 10:12:06 2016(r294409)
@@ -240,6 +240,7 @@ versus
 whu
 will
 wkoszek
+wma
 wollman
 yongari
 zbb

Modified: svnadmin/conf/mentors
==
--- svnadmin/conf/mentors   Wed Jan 20 09:50:54 2016(r294408)
+++ svnadmin/conf/mentors   Wed Jan 20 10:12:06 2016(r294409)
@@ -38,3 +38,4 @@ skra  kib
 torek  rpaulo
 venkat delphij Co-mentor: luigi, jhb
 versus gavin   Co-mentor: fjoe
+wmacognet
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r290465 - head/sys/arm/ti

2015-11-06 Thread Olivier Houchard
Author: cognet
Date: Fri Nov  6 20:12:31 2015
New Revision: 290465
URL: https://svnweb.freebsd.org/changeset/base/290465

Log:
  Include opt_platform.h to get FDT defined.

Modified:
  head/sys/arm/ti/ti_common.c

Modified: head/sys/arm/ti/ti_common.c
==
--- head/sys/arm/ti/ti_common.c Fri Nov  6 20:10:54 2015(r290464)
+++ head/sys/arm/ti/ti_common.c Fri Nov  6 20:12:31 2015(r290465)
@@ -29,6 +29,8 @@
  * SUCH DAMAGE.
  */
 
+#include "opt_platform.h"
+
 #include 
 __FBSDID("$FreeBSD$");
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r290422 - head/sys/arm/at91

2015-11-05 Thread Olivier Houchard
Author: cognet
Date: Thu Nov  5 22:03:42 2015
New Revision: 290422
URL: https://svnweb.freebsd.org/changeset/base/290422

Log:
  Make if_macb work with FDT.

Modified:
  head/sys/arm/at91/if_macb.c

Modified: head/sys/arm/at91/if_macb.c
==
--- head/sys/arm/at91/if_macb.c Thu Nov  5 22:03:27 2015(r290421)
+++ head/sys/arm/at91/if_macb.c Thu Nov  5 22:03:42 2015(r290422)
@@ -24,6 +24,8 @@
  * SUCH DAMAGE.
  */
 
+#include "opt_platform.h"
+
 #include 
 __FBSDID("$FreeBSD$");
 
@@ -72,6 +74,12 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#ifdef FDT
+#include 
+#include 
+#include 
+#endif
+
 /* "device miibus" required.  See GENERIC if you get errors here. */
 #include "miibus_if.h"
 
@@ -1196,6 +1204,11 @@ macbioctl(struct ifnet * ifp, u_long cmd
 static int
 macb_probe(device_t dev)
 {
+#ifdef FDT
+if (!ofw_bus_is_compatible(dev, "cdns,at32ap7000-macb"))
+return (ENXIO);
+#endif
+
device_set_desc(dev, "macb");
return (0);
 }
@@ -1546,7 +1559,11 @@ static driver_t macb_driver = {
 };
 
 
+#ifdef FDT
+DRIVER_MODULE(macb, simplebus, macb_driver, macb_devclass, NULL, NULL);
+#else
 DRIVER_MODULE(macb, atmelarm, macb_driver, macb_devclass, 0, 0);
+#endif
 DRIVER_MODULE(miibus, macb, miibus_driver, miibus_devclass, 0, 0);
 MODULE_DEPEND(macb, miibus, 1, 1, 1);
 MODULE_DEPEND(macb, ether, 1, 1, 1);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r290420 - head/sys/arm/at91

2015-11-05 Thread Olivier Houchard
Author: cognet
Date: Thu Nov  5 22:03:20 2015
New Revision: 290420
URL: https://svnweb.freebsd.org/changeset/base/290420

Log:
  Make at91_pmc probe any at91 pmc device we support, not just at91rm9200.
  
  MFC after:1 week

Modified:
  head/sys/arm/at91/at91_pmc.c

Modified: head/sys/arm/at91/at91_pmc.c
==
--- head/sys/arm/at91/at91_pmc.cThu Nov  5 21:54:35 2015
(r290419)
+++ head/sys/arm/at91/at91_pmc.cThu Nov  5 22:03:20 2015
(r290420)
@@ -661,7 +661,10 @@ static int
 at91_pmc_probe(device_t dev)
 {
 #ifdef FDT
-   if (!ofw_bus_is_compatible(dev, "atmel,at91rm9200-pmc"))
+   if (!ofw_bus_is_compatible(dev, "atmel,at91rm9200-pmc") &&
+   !ofw_bus_is_compatible(dev, "atmel,at91sam9260-pmc") &&
+   !ofw_bus_is_compatible(dev, "atmel,at91sam9g45-pmc") &&
+   !ofw_bus_is_compatible(dev, "atmel,at91sam9x5-pmc"))
return (ENXIO);
 #endif
device_set_desc(dev, "PMC");
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r280324 - head/sys/arm/arm

2015-03-21 Thread Olivier Houchard
Author: cognet
Date: Sat Mar 21 15:32:59 2015
New Revision: 280324
URL: https://svnweb.freebsd.org/changeset/base/280324

Log:
  When waiting on PTE allocation, another thread could free the l2_dtable while
  we're not looking at it.
  Fix this by increasing l2-l2_occupancy before we try to alloc (and decrease
  it if the allocation failed, or if another thread did a similar allocation).
  
  Submitted by: Kohji Okuno okuno.ko...@jp.panasonic.com
  MFC after:1 week

Modified:
  head/sys/arm/arm/pmap-v6.c
  head/sys/arm/arm/pmap.c

Modified: head/sys/arm/arm/pmap-v6.c
==
--- head/sys/arm/arm/pmap-v6.c  Sat Mar 21 15:01:19 2015(r280323)
+++ head/sys/arm/arm/pmap-v6.c  Sat Mar 21 15:32:59 2015(r280324)
@@ -758,6 +758,7 @@ pmap_alloc_l2_bucket(pmap_t pmap, vm_off
 * No L2 page table has been allocated. Chances are, this
 * is because we just allocated the l2_dtable, above.
 */
+   l2-l2_occupancy++;
PMAP_UNLOCK(pmap);
rw_wunlock(pvh_global_lock);
ptep = uma_zalloc(l2zone, M_NOWAIT);
@@ -765,6 +766,7 @@ pmap_alloc_l2_bucket(pmap_t pmap, vm_off
PMAP_LOCK(pmap);
if (l2b-l2b_kva != 0) {
/* We lost the race. */
+   l2-l2_occupancy--;
uma_zfree(l2zone, ptep);
return (l2b);
}
@@ -775,6 +777,7 @@ pmap_alloc_l2_bucket(pmap_t pmap, vm_off
 * time. We may need to deallocate the l2_dtable
 * if we allocated a new one above.
 */
+   l2-l2_occupancy--;
if (l2-l2_occupancy == 0) {
pmap-pm_l2[L2_IDX(l1idx)] = NULL;
uma_zfree(l2table_zone, l2);
@@ -782,7 +785,6 @@ pmap_alloc_l2_bucket(pmap_t pmap, vm_off
return (NULL);
}
 
-   l2-l2_occupancy++;
l2b-l2b_kva = ptep;
l2b-l2b_l1idx = l1idx;
}

Modified: head/sys/arm/arm/pmap.c
==
--- head/sys/arm/arm/pmap.c Sat Mar 21 15:01:19 2015(r280323)
+++ head/sys/arm/arm/pmap.c Sat Mar 21 15:32:59 2015(r280324)
@@ -878,6 +878,7 @@ pmap_alloc_l2_bucket(pmap_t pm, vm_offse
 * No L2 page table has been allocated. Chances are, this
 * is because we just allocated the l2_dtable, above.
 */
+   l2-l2_occupancy++;
PMAP_UNLOCK(pm);
rw_wunlock(pvh_global_lock);
ptep = uma_zalloc(l2zone, M_NOWAIT);
@@ -885,6 +886,7 @@ pmap_alloc_l2_bucket(pmap_t pm, vm_offse
PMAP_LOCK(pm);
if (l2b-l2b_kva != 0) {
/* We lost the race. */
+   l2-l2_occupancy--;
uma_zfree(l2zone, ptep);
return (l2b);
}
@@ -895,6 +897,7 @@ pmap_alloc_l2_bucket(pmap_t pm, vm_offse
 * time. We may need to deallocate the l2_dtable
 * if we allocated a new one above.
 */
+   l2-l2_occupancy--;
if (l2-l2_occupancy == 0) {
pm-pm_l2[L2_IDX(l1idx)] = NULL;
uma_zfree(l2table_zone, l2);
@@ -902,7 +905,6 @@ pmap_alloc_l2_bucket(pmap_t pm, vm_offse
return (NULL);
}
 
-   l2-l2_occupancy++;
l2b-l2b_kva = ptep;
l2b-l2b_l1idx = l1idx;
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280325 - head/sys/kern

2015-03-21 Thread Olivier Houchard
Author: cognet
Date: Sat Mar 21 16:16:17 2015
New Revision: 280325
URL: https://svnweb.freebsd.org/changeset/base/280325

Log:
  error is only used if MAC is defined, so make its declaration conditional
  as well.

Modified:
  head/sys/kern/sysv_shm.c

Modified: head/sys/kern/sysv_shm.c
==
--- head/sys/kern/sysv_shm.cSat Mar 21 15:32:59 2015(r280324)
+++ head/sys/kern/sysv_shm.cSat Mar 21 16:16:17 2015(r280325)
@@ -596,7 +596,9 @@ shmget_existing(struct thread *td, struc
 int segnum)
 {
struct shmid_kernel *shmseg;
+#ifdef MAC
int error;
+#endif
 
SYSVSHM_ASSERT_LOCKED();
KASSERT(segnum = 0  segnum  shmalloced,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r266849 - head/sys/arm/arm

2014-05-29 Thread Olivier Houchard
Author: cognet
Date: Thu May 29 16:54:15 2014
New Revision: 266849
URL: http://svnweb.freebsd.org/changeset/base/266849

Log:
  For old CPUs, map the 64 first MB of RAM as it used to be. Some ports
  (XScale mainly) expects the memory located before the kernel to be mapped,
  and use it to allocate the page tables, the various stacks, etc.
  A better fix would probably be to rewrite the various bla_machdep.c to stop
  using that RAM, but I'm not so inclined to do it, especially since I don't
  have hardware for all of them.

Modified:
  head/sys/arm/arm/locore.S

Modified: head/sys/arm/arm/locore.S
==
--- head/sys/arm/arm/locore.S   Thu May 29 16:20:34 2014(r266848)
+++ head/sys/arm/arm/locore.S   Thu May 29 16:54:15 2014(r266849)
@@ -166,9 +166,32 @@ Lunmapped:
ldr r1, [r0, #4]
sub r0, r1, r2
 
+#ifndef _ARM_ARCH_6
/*
-* Map PA == VA
+* Some of the older ports (the various XScale, mostly) assume
+* that the memory before the kernel is mapped, and use it for
+* the various stacks, page tables, etc. For those CPUs, map the 
+* 64 first MB of RAM, as it used to be. 
 */
+   /*
+* Map PA == VA
+*/
+   ldr r5, =PHYSADDR
+   mov r1, r5
+   mov r2, r5
+   /* Map 64MiB, preserved over calls to build_pagetables */
+   mov r3, #64
+   bl  build_pagetables
+   
+   /* Create the kernel map to jump to */
+   mov r1, r5
+   ldr r2, =(KERNBASE)
+   bl  build_pagetables
+   ldr r5, =(KERNPHYSADDR)
+#else
+   /*
+* Map PA == VA
+*/
/* Find the start kernels load address */
adr r5, _start
ldr r2, =(L1_S_OFFSET)
@@ -183,6 +206,7 @@ Lunmapped:
mov r1, r5
ldr r2, =(KERNVIRTADDR)
bl  build_pagetables
+#endif

 #if defined(SOCDEV_PA)  defined(SOCDEV_VA)
/* Create the custom map */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r266850 - in head/sys/arm/xscale: i80321 i8134x ixp425 pxa

2014-05-29 Thread Olivier Houchard
Author: cognet
Date: Thu May 29 16:56:39 2014
New Revision: 266850
URL: http://svnweb.freebsd.org/changeset/base/266850

Log:
  Do not hand the VM the memory used for stacks/page tables/etc.

Modified:
  head/sys/arm/xscale/i80321/ep80219_machdep.c
  head/sys/arm/xscale/i80321/iq31244_machdep.c
  head/sys/arm/xscale/i8134x/crb_machdep.c
  head/sys/arm/xscale/ixp425/avila_machdep.c
  head/sys/arm/xscale/pxa/pxa_machdep.c

Modified: head/sys/arm/xscale/i80321/ep80219_machdep.c
==
--- head/sys/arm/xscale/i80321/ep80219_machdep.cThu May 29 16:54:15 
2014(r266849)
+++ head/sys/arm/xscale/i80321/ep80219_machdep.cThu May 29 16:56:39 
2014(r266850)
@@ -341,6 +341,10 @@ initarm(struct arm_boot_params *abp)
 * Prepare the list of physical memory available to the vm subsystem.
 */
arm_physmem_hardware_region(IQ80321_SDRAM_START, memsize);
+   arm_physmem_exclude_region(freemem_pt, KERNPHYSADDR -
+   freemem_pt, EXFLAG_NOALLOC);
+   arm_physmem_exclude_region(freemempos, KERNPHYSADDR - 0x10 -
+   freemempos, EXFLAG_NOALLOC);
arm_physmem_exclude_region(abp-abp_physaddr, 
virtual_avail - KERNVIRTADDR, EXFLAG_NOALLOC);
arm_physmem_init_kernel_globals();

Modified: head/sys/arm/xscale/i80321/iq31244_machdep.c
==
--- head/sys/arm/xscale/i80321/iq31244_machdep.cThu May 29 16:54:15 
2014(r266849)
+++ head/sys/arm/xscale/i80321/iq31244_machdep.cThu May 29 16:56:39 
2014(r266850)
@@ -343,6 +343,10 @@ initarm(struct arm_boot_params *abp)
 * Prepare the list of physical memory available to the vm subsystem.
 */
arm_physmem_hardware_region(SDRAM_START, memsize);
+   arm_physmem_exclude_region(freemem_pt, KERNPHYSADDR -
+   freemem_pt, EXFLAG_NOALLOC);
+   arm_physmem_exclude_region(freemempos, KERNPHYSADDR - 0x10 -
+   freemempos, EXFLAG_NOALLOC);
arm_physmem_exclude_region(abp-abp_physaddr, 
virtual_avail - KERNVIRTADDR, EXFLAG_NOALLOC);
arm_physmem_init_kernel_globals();

Modified: head/sys/arm/xscale/i8134x/crb_machdep.c
==
--- head/sys/arm/xscale/i8134x/crb_machdep.cThu May 29 16:54:15 2014
(r266849)
+++ head/sys/arm/xscale/i8134x/crb_machdep.cThu May 29 16:56:39 2014
(r266850)
@@ -323,6 +323,10 @@ initarm(struct arm_boot_params *abp)
 * Prepare the list of physical memory available to the vm subsystem.
 */
arm_physmem_hardware_region(SDRAM_START, memsize);
+   arm_physmem_exclude_region(freemem_pt, KERNPHYSADDR -
+   freemem_pt, EXFLAG_NOALLOC);
+   arm_physmem_exclude_region(freemempos, KERNPHYSADDR - 0x10 -
+   freemempos, EXFLAG_NOALLOC);
arm_physmem_exclude_region(abp-abp_physaddr, 
virtual_avail - KERNVIRTADDR, EXFLAG_NOALLOC);
arm_physmem_init_kernel_globals();

Modified: head/sys/arm/xscale/ixp425/avila_machdep.c
==
--- head/sys/arm/xscale/ixp425/avila_machdep.c  Thu May 29 16:54:15 2014
(r266849)
+++ head/sys/arm/xscale/ixp425/avila_machdep.c  Thu May 29 16:56:39 2014
(r266850)
@@ -413,6 +413,10 @@ initarm(struct arm_boot_params *abp)
 * Prepare the list of physical memory available to the vm subsystem.
 */
arm_physmem_hardware_region(PHYSADDR, memsize);
+   arm_physmem_exclude_region(freemem_pt, KERNPHYSADDR -
+   freemem_pt, EXFLAG_NOALLOC);
+   arm_physmem_exclude_region(freemempos, KERNPHYSADDR - 0x10 -
+   freemempos, EXFLAG_NOALLOC);
arm_physmem_exclude_region(abp-abp_physaddr, 
virtual_avail - KERNVIRTADDR, EXFLAG_NOALLOC);
arm_physmem_init_kernel_globals();

Modified: head/sys/arm/xscale/pxa/pxa_machdep.c
==
--- head/sys/arm/xscale/pxa/pxa_machdep.c   Thu May 29 16:54:15 2014
(r266849)
+++ head/sys/arm/xscale/pxa/pxa_machdep.c   Thu May 29 16:56:39 2014
(r266850)
@@ -335,6 +335,10 @@ initarm(struct arm_boot_params *abp)
if (memsize[j]  0)
arm_physmem_hardware_region(memstart[j], memsize[j]);
}
+   arm_physmem_exclude_region(freemem_pt, KERNPHYSADDR -
+   freemem_pt, EXFLAG_NOALLOC);
+   arm_physmem_exclude_region(freemempos, KERNPHYSADDR - 0x10 -
+   freemempos, EXFLAG_NOALLOC);
arm_physmem_exclude_region(abp-abp_physaddr, 
virtual_avail - KERNVIRTADDR, EXFLAG_NOALLOC);
arm_physmem_init_kernel_globals();
___

svn commit: r266855 - head/sys/dev/uart

2014-05-29 Thread Olivier Houchard
Author: cognet
Date: Thu May 29 19:57:51 2014
New Revision: 266855
URL: http://svnweb.freebsd.org/changeset/base/266855

Log:
  In the grab function, keep the bit 6 on in the IER, on XScale, using 0
  turns the UART off, which is unfortunate if one want to use it as a console.

Modified:
  head/sys/dev/uart/uart_dev_ns8250.c

Modified: head/sys/dev/uart/uart_dev_ns8250.c
==
--- head/sys/dev/uart/uart_dev_ns8250.c Thu May 29 19:48:18 2014
(r266854)
+++ head/sys/dev/uart/uart_dev_ns8250.c Thu May 29 19:57:51 2014
(r266855)
@@ -929,6 +929,7 @@ void
 ns8250_bus_grab(struct uart_softc *sc)
 {
struct uart_bas *bas = sc-sc_bas;
+   struct ns8250_softc *ns8250 = (struct ns8250_softc*)sc;
 
/*
 * turn off all interrupts to enter polling mode. Leave the
@@ -936,7 +937,11 @@ ns8250_bus_grab(struct uart_softc *sc)
 * All pending interupt signals are reset when IER is set to 0.
 */
uart_lock(sc-sc_hwmtx);
-   uart_setreg(bas, REG_IER, 0);
+   /*
+* On XScale, bit 6 (0x40) is the UART Unit Enable, removing it
+* turns the UART completely off,  so make sure it is stays there.
+*/
+   uart_setreg(bas, REG_IER, ns8250-ier  0x40);
uart_barrier(bas);
uart_unlock(sc-sc_hwmtx);
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r266855 - head/sys/dev/uart

2014-05-29 Thread Olivier Houchard
On Thu, May 29, 2014 at 01:44:54PM -0700, John-Mark Gurney wrote:
 Olivier Houchard wrote this message on Thu, May 29, 2014 at 19:57 +:
  Author: cognet
  Date: Thu May 29 19:57:51 2014
  New Revision: 266855
  URL: http://svnweb.freebsd.org/changeset/base/266855
  
  Log:
In the grab function, keep the bit 6 on in the IER, on XScale, using 0
turns the UART off, which is unfortunate if one want to use it as a 
  console.
  
  Modified:
head/sys/dev/uart/uart_dev_ns8250.c
  
  Modified: head/sys/dev/uart/uart_dev_ns8250.c
  ==
  --- head/sys/dev/uart/uart_dev_ns8250.c Thu May 29 19:48:18 2014
  (r266854)
  +++ head/sys/dev/uart/uart_dev_ns8250.c Thu May 29 19:57:51 2014
  (r266855)
  @@ -929,6 +929,7 @@ void
   ns8250_bus_grab(struct uart_softc *sc)
   {
  struct uart_bas *bas = sc-sc_bas;
  +   struct ns8250_softc *ns8250 = (struct ns8250_softc*)sc;
   
  /*
   * turn off all interrupts to enter polling mode. Leave the
  @@ -936,7 +937,11 @@ ns8250_bus_grab(struct uart_softc *sc)
   * All pending interupt signals are reset when IER is set to 0.
   */
  uart_lock(sc-sc_hwmtx);
  -   uart_setreg(bas, REG_IER, 0);
  +   /*
  +* On XScale, bit 6 (0x40) is the UART Unit Enable, removing it
  +* turns the UART completely off,  so make sure it is stays there.
  +*/
  +   uart_setreg(bas, REG_IER, ns8250-ier  0x40);
  uart_barrier(bas);
  uart_unlock(sc-sc_hwmtx);
   }
 
 Should this be using ns8250-ier_mask instead of 0x40?
 
 It also looks like AVILA doesn't have the hints to set this like
 GUMSTIX does, and maybe adding this will help?
 

Hmm you're right, this is probably better, I'll just do that :)

Olivier
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


  1   2   3   >