svn commit: r261627 - head/sys/net

2014-02-08 Thread Gleb Smirnoff
Author: glebius
Date: Sat Feb  8 09:56:26 2014
New Revision: 261627
URL: http://svnweb.freebsd.org/changeset/base/261627

Log:
  Remove never set flag FL_OVERWRITE. The only place where
  it was checked led to lock/critnest leak.

Modified:
  head/sys/net/flowtable.c
  head/sys/net/pfvar.h

Modified: head/sys/net/flowtable.c
==
--- head/sys/net/flowtable.cSat Feb  8 09:50:02 2014(r261626)
+++ head/sys/net/flowtable.cSat Feb  8 09:56:26 2014(r261627)
@@ -280,7 +280,6 @@ flowtable_pcpu_unlock(struct flowtable *
 #define FL_ENTRY_UNLOCK(table, hash) (table)->ft_unlock((table), (hash))
 
 #define FL_STALE   (1<<8)
-#define FL_OVERWRITE   (1<<10)
 
 static struct flentry *flowtable_lookup_common(struct flowtable *,
 struct sockaddr_storage *, struct sockaddr_storage *, struct mbuf *, int);
@@ -833,8 +832,6 @@ flowtable_insert(struct flowtable *ft, u
FL_ENTRY_UNLOCK(ft, hash);
uma_zfree(ft->ft_zone, newfle);

-   if (flags & FL_OVERWRITE)
-   goto skip;
return (EEXIST);
}
/*

Modified: head/sys/net/pfvar.h
==
--- head/sys/net/pfvar.hSat Feb  8 09:50:02 2014(r261626)
+++ head/sys/net/pfvar.hSat Feb  8 09:56:26 2014(r261627)
@@ -1580,8 +1580,6 @@ extern struct pf_src_node *pf_find_src_n
 extern void pf_unlink_src_node(struct pf_src_node *);
 extern void pf_unlink_src_node_locked(struct pf_src_node 
*);
 extern u_intpf_free_src_nodes(struct pf_src_node_list *);
-extern void pf_print_state(struct pf_state *);
-extern void pf_print_flags(u_int8_t);
 extern u_int16_tpf_cksum_fixup(u_int16_t, u_int16_t, u_int16_t,
u_int8_t);
 
@@ -1744,8 +1742,6 @@ int   pf_osfp_get(struct pf_osfp_ioctl *);
 intpf_osfp_match(struct pf_osfp_enlist *, pf_osfp_t);
 
 #ifdef _KERNEL
-voidpf_print_host(struct pf_addr *, u_int16_t, u_int8_t);
-
 voidpf_step_into_anchor(struct pf_anchor_stackframe *, int 
*,
struct pf_ruleset **, int, struct pf_rule **,
struct pf_rule **, int *);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r261628 - head/sys/net

2014-02-08 Thread Gleb Smirnoff
Author: glebius
Date: Sat Feb  8 09:57:52 2014
New Revision: 261628
URL: http://svnweb.freebsd.org/changeset/base/261628

Log:
  Revert accidentially leaked changes in r261627.

Modified:
  head/sys/net/pfvar.h

Modified: head/sys/net/pfvar.h
==
--- head/sys/net/pfvar.hSat Feb  8 09:56:26 2014(r261627)
+++ head/sys/net/pfvar.hSat Feb  8 09:57:52 2014(r261628)
@@ -1580,6 +1580,8 @@ extern struct pf_src_node *pf_find_src_n
 extern void pf_unlink_src_node(struct pf_src_node *);
 extern void pf_unlink_src_node_locked(struct pf_src_node 
*);
 extern u_intpf_free_src_nodes(struct pf_src_node_list *);
+extern void pf_print_state(struct pf_state *);
+extern void pf_print_flags(u_int8_t);
 extern u_int16_tpf_cksum_fixup(u_int16_t, u_int16_t, u_int16_t,
u_int8_t);
 
@@ -1742,6 +1744,8 @@ int   pf_osfp_get(struct pf_osfp_ioctl *);
 intpf_osfp_match(struct pf_osfp_enlist *, pf_osfp_t);
 
 #ifdef _KERNEL
+voidpf_print_host(struct pf_addr *, u_int16_t, u_int8_t);
+
 voidpf_step_into_anchor(struct pf_anchor_stackframe *, int 
*,
struct pf_ruleset **, int, struct pf_rule **,
struct pf_rule **, int *);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r261633 - head/usr.bin/csplit

2014-02-08 Thread Joel Dahl
Author: joel (doc committer)
Date: Sat Feb  8 13:29:35 2014
New Revision: 261633
URL: http://svnweb.freebsd.org/changeset/base/261633

Log:
  Correct example.
  
  Submitted by:Jason McIntyre 
   Thomas Klausner 

Modified:
  head/usr.bin/csplit/csplit.1

Modified: head/usr.bin/csplit/csplit.1
==
--- head/usr.bin/csplit/csplit.1Sat Feb  8 11:05:48 2014
(r261632)
+++ head/usr.bin/csplit/csplit.1Sat Feb  8 13:29:35 2014
(r261633)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 24, 2008
+.Dd February 6, 2014
 .Dt CSPLIT 1
 .Os
 .Sh NAME
@@ -143,7 +143,7 @@ Split the
 .Xr mdoc 7
 file
 .Pa foo.1
-into one file for each section (up to 20):
+into one file for each section (up to 21 plus one for the rest, if any):
 .Pp
 .Dl "csplit -k foo.1 '%^\e.Sh%' '/^\e.Sh/' '{20}'"
 .Pp
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r261634 - in head: usr.bin/chpass usr.bin/grep usr.bin/indent usr.bin/rpcgen usr.bin/whois usr.bin/xargs usr.sbin/bluetooth/btpand usr.sbin/ifmcstat usr.sbin/ppp usr.sbin/watchdogd

2014-02-08 Thread Joel Dahl
Author: joel (doc committer)
Date: Sat Feb  8 13:37:02 2014
New Revision: 261634
URL: http://svnweb.freebsd.org/changeset/base/261634

Log:
  mdoc: minor paragraph fixes.

Modified:
  head/usr.bin/chpass/chpass.1
  head/usr.bin/grep/grep.1
  head/usr.bin/indent/indent.1
  head/usr.bin/rpcgen/rpcgen.1
  head/usr.bin/whois/whois.1
  head/usr.bin/xargs/xargs.1
  head/usr.sbin/bluetooth/btpand/btpand.8
  head/usr.sbin/ifmcstat/ifmcstat.8
  head/usr.sbin/ppp/ppp.8
  head/usr.sbin/watchdogd/watchdogd.8

Modified: head/usr.bin/chpass/chpass.1
==
--- head/usr.bin/chpass/chpass.1Sat Feb  8 13:29:35 2014
(r261633)
+++ head/usr.bin/chpass/chpass.1Sat Feb  8 13:37:02 2014
(r261634)
@@ -317,7 +317,6 @@ password -- see below) will be silently 
 .Pp
 Exception: the super-user on the NIS master server is permitted to
 change any field.
-.Pp
 .It
 .Em "Password authentication is required" .
 The
@@ -433,7 +432,6 @@ option can be used in conjunction with t
 .Fl d
 option, in which case the user-specified hostname will override
 the default.
-.Pp
 .It Fl o
 Force the use of RPC-based updates when communicating with
 .Xr rpc.yppasswdd 8

Modified: head/usr.bin/grep/grep.1
==
--- head/usr.bin/grep/grep.1Sat Feb  8 13:29:35 2014(r261633)
+++ head/usr.bin/grep/grep.1Sat Feb  8 13:37:02 2014(r261634)
@@ -398,8 +398,8 @@ The default is 2.
 Force output to be line buffered.
 By default, output is line buffered when standard output is a terminal
 and block buffered otherwise.
-.Pp
 .El
+.Pp
 If no file arguments are specified, the standard input is used.
 .Sh EXIT STATUS
 The

Modified: head/usr.bin/indent/indent.1
==
--- head/usr.bin/indent/indent.1Sat Feb  8 13:29:35 2014
(r261633)
+++ head/usr.bin/indent/indent.1Sat Feb  8 13:37:02 2014
(r261634)
@@ -184,7 +184,6 @@ if (...) {
   code
 }
 .Ed
-.Pp
 .It Fl c Ns Ar n
 The column in which comments on code start.
 The default is 33.

Modified: head/usr.bin/rpcgen/rpcgen.1
==
--- head/usr.bin/rpcgen/rpcgen.1Sat Feb  8 13:29:35 2014
(r261633)
+++ head/usr.bin/rpcgen/rpcgen.1Sat Feb  8 13:37:02 2014
(r261634)
@@ -328,7 +328,6 @@ Contrary to some systems, in
 this option is needed to generate
 servers that can be invoked through portmonitors and
 .Xr inetd 8 .
-.Pp
 .It Fl K Ar seconds
 By default, services created using
 .Nm

Modified: head/usr.bin/whois/whois.1
==
--- head/usr.bin/whois/whois.1  Sat Feb  8 13:29:35 2014(r261633)
+++ head/usr.bin/whois/whois.1  Sat Feb  8 13:37:02 2014(r261634)
@@ -62,7 +62,6 @@ nor by
 .Tn ARIN
 whois database end with
 .Qq Li -ARIN . )
-.Pp
 .It Fl A
 Use the Asia/Pacific Network Information Center
 .Pq Tn APNIC

Modified: head/usr.bin/xargs/xargs.1
==
--- head/usr.bin/xargs/xargs.1  Sat Feb  8 13:29:35 2014(r261633)
+++ head/usr.bin/xargs/xargs.1  Sat Feb  8 13:37:02 2014(r261634)
@@ -164,7 +164,6 @@ directory to
 .Pa destdir :
 .Pp
 .Dl /bin/ls -1d [A-Z]* | xargs -J % cp -Rp % destdir
-.Pp
 .It Fl L Ar number
 Call
 .Ar utility

Modified: head/usr.sbin/bluetooth/btpand/btpand.8
==
--- head/usr.sbin/bluetooth/btpand/btpand.8 Sat Feb  8 13:29:35 2014
(r261633)
+++ head/usr.sbin/bluetooth/btpand/btpand.8 Sat Feb  8 13:37:02 2014
(r261634)
@@ -159,7 +159,6 @@ Network Access Point.
 .It PANU
 Personal Area Networking User.
 .El
-.Pp
 .It Fl S Ar service
 As per
 .Fl s

Modified: head/usr.sbin/ifmcstat/ifmcstat.8
==
--- head/usr.sbin/ifmcstat/ifmcstat.8   Sat Feb  8 13:29:35 2014
(r261633)
+++ head/usr.sbin/ifmcstat/ifmcstat.8   Sat Feb  8 13:37:02 2014
(r261634)
@@ -54,7 +54,6 @@ The following options are supported:
 .Bl -tag -width Fl
 .It Fl i Ar interface
 specifies the interface to be displayed.
-.Pp
 .It Fl f Ar address-family
 specifies the address family to be displayed;
 .Ar inet ,

Modified: head/usr.sbin/ppp/ppp.8
==
--- head/usr.sbin/ppp/ppp.8 Sat Feb  8 13:29:35 2014(r261633)
+++ head/usr.sbin/ppp/ppp.8 Sat Feb  8 13:37:02 2014(r261634)
@@ -1188,7 +1188,6 @@ Use Hardware Handshake (CTS/RTS) for flo
 .It
 Modem should be set to NO echo back (ATE0) and NO results string (ATQ1).
 .El
-.Pp
 .It
 Edit
 .Pa /etc/ttys
@@ -1796,7 +1795,6 @@ If no timeout is given, the

svn commit: r261635 - head/sbin/init

2014-02-08 Thread Jilles Tjoelker
Author: jilles
Date: Sat Feb  8 13:51:15 2014
New Revision: 261635
URL: http://svnweb.freebsd.org/changeset/base/261635

Log:
  init: Remove code to track line numbers in /etc/ttys.
  
  The tracking generated warnings when the line number of an existing tty in
  /etc/ttys changed, which would corrupt utmp (as it was indexed by the line
  number). With utmpx, the line number no longer matters, so the tracking is
  no longer needed.

Modified:
  head/sbin/init/init.c

Modified: head/sbin/init/init.c
==
--- head/sbin/init/init.c   Sat Feb  8 13:37:02 2014(r261634)
+++ head/sbin/init/init.c   Sat Feb  8 13:51:15 2014(r261635)
@@ -143,7 +143,6 @@ static const char *get_shell(void);
 static void write_stderr(const char *message);
 
 typedef struct init_session {
-   int se_index;   /* index of entry in ttys file */
pid_t   se_process; /* controlling process */
time_t  se_started; /* used to avoid thrashing */
int se_flags;   /* status of session */
@@ -163,7 +162,7 @@ typedef struct init_session {
 } session_t;
 
 static void free_session(session_t *);
-static session_t *new_session(session_t *, int, struct ttyent *);
+static session_t *new_session(session_t *, struct ttyent *);
 static session_t *sessions;
 
 static char **construct_argv(char *);
@@ -1005,7 +1004,7 @@ free_session(session_t *sp)
  * Mark it SE_PRESENT.
  */
 static session_t *
-new_session(session_t *sprev, int session_index, struct ttyent *typ)
+new_session(session_t *sprev, struct ttyent *typ)
 {
session_t *sp;
int fd;
@@ -1017,7 +1016,6 @@ new_session(session_t *sprev, int sessio
 
sp = (session_t *) calloc(1, sizeof (session_t));
 
-   sp->se_index = session_index;
sp->se_flags |= SE_PRESENT;
 
sp->se_device = malloc(sizeof(_PATH_DEV) + strlen(typ->ty_name));
@@ -1107,7 +1105,6 @@ setupargv(session_t *sp, struct ttyent *
 static state_func_t
 read_ttys(void)
 {
-   int session_index = 0;
session_t *sp, *snext;
struct ttyent *typ;
 
@@ -1128,7 +1125,7 @@ read_ttys(void)
 * Note that sp starts at 0.
 */
while ((typ = getttyent()) != NULL)
-   if ((snext = new_session(sp, ++session_index, typ)) != NULL)
+   if ((snext = new_session(sp, typ)) != NULL)
sp = snext;
 
endttyent();
@@ -1380,7 +1377,6 @@ clean_ttys(void)
 {
session_t *sp, *sprev;
struct ttyent *typ;
-   int session_index = 0;
int devlen;
char *old_getty, *old_window, *old_type;
 
@@ -1394,8 +1390,6 @@ clean_ttys(void)
 
devlen = sizeof(_PATH_DEV) - 1;
while ((typ = getttyent()) != NULL) {
-   ++session_index;
-
for (sprev = 0, sp = sessions; sp; sprev = sp, sp = sp->se_next)
if (strcmp(typ->ty_name, sp->se_device + devlen) == 0)
break;
@@ -1403,12 +1397,6 @@ clean_ttys(void)
if (sp) {
/* we want this one to live */
sp->se_flags |= SE_PRESENT;
-   if (sp->se_index != session_index) {
-   warning("port %s changed utmp index from %d to 
%d",
-  sp->se_device, sp->se_index,
-  session_index);
-   sp->se_index = session_index;
-   }
if ((typ->ty_status & TTY_ON) == 0 ||
typ->ty_getty == 0) {
sp->se_flags |= SE_SHUTDOWN;
@@ -1448,7 +1436,7 @@ clean_ttys(void)
continue;
}
 
-   new_session(sprev, session_index, typ);
+   new_session(sprev, typ);
}
 
endttyent();
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r261638 - in head/sys/amd64/vmm: . intel

2014-02-08 Thread John Baldwin
Author: jhb
Date: Sat Feb  8 16:37:54 2014
New Revision: 261638
URL: http://svnweb.freebsd.org/changeset/base/261638

Log:
  Add virtualized XSAVE support to bhyve which permits guests to use XSAVE and
  XSAVE-enabled features like AVX.
  - Store a per-cpu guest xcr0 register.  When switching to the guest FPU
state, switch to the guest xcr0 value.  Note that the guest FPU state is
saved and restored using the host's xcr0 value and xcr0 is saved/restored
"inside" of saving/restoring the guest FPU state.
  - Handle VM exits for the xsetbv instruction by updating the guest xcr0.
  - Expose the XSAVE feature to the guest only if the host has enabled XSAVE,
and only advertise XSAVE features enabled by the host to the guest.
This ensures that the guest will only adjust FPU state that is a subset
of the guest FPU state saved and restored by the host.
  
  Reviewed by:  grehan

Modified:
  head/sys/amd64/vmm/intel/vmx.c
  head/sys/amd64/vmm/vmm.c
  head/sys/amd64/vmm/vmm_host.c
  head/sys/amd64/vmm/vmm_host.h
  head/sys/amd64/vmm/x86.c

Modified: head/sys/amd64/vmm/intel/vmx.c
==
--- head/sys/amd64/vmm/intel/vmx.c  Sat Feb  8 15:51:42 2014
(r261637)
+++ head/sys/amd64/vmm/intel/vmx.c  Sat Feb  8 16:37:54 2014
(r261638)
@@ -1228,6 +1228,40 @@ vmx_clear_nmi_blocking(struct vmx *vmx, 
 }
 
 static int
+vmx_emulate_xsetbv(struct vmx *vmx, int vcpu)
+{
+   struct vmxctx *vmxctx;
+   uint64_t xcrval;
+   const struct xsave_limits *limits;
+
+   vmxctx = &vmx->ctx[vcpu];
+   limits = vmm_get_xsave_limits();
+
+   /* We only handle xcr0 if the host has XSAVE enabled. */
+   if (vmxctx->guest_rcx != 0 || !limits->xsave_enabled)
+   return (UNHANDLED);
+
+   xcrval = vmxctx->guest_rdx << 32 | (vmxctx->guest_rax & 0x);
+   if ((xcrval & ~limits->xcr0_allowed) != 0)
+   return (UNHANDLED);
+
+   if (!(xcrval & XFEATURE_ENABLED_X87))
+   return (UNHANDLED);
+
+   if ((xcrval & (XFEATURE_ENABLED_AVX | XFEATURE_ENABLED_SSE)) ==
+   XFEATURE_ENABLED_AVX)
+   return (UNHANDLED);
+
+   /*
+* This runs "inside" vmrun() with the guest's FPU state, so
+* modifying xcr0 directly modifies the guest's xcr0, not the
+* host's.
+*/
+   load_xcr(0, xcrval);
+   return (HANDLED);
+}
+
+static int
 vmx_emulate_cr_access(struct vmx *vmx, int vcpu, uint64_t exitqual)
 {
int cr, vmcs_guest_cr, vmcs_shadow_cr;
@@ -1774,6 +1808,9 @@ vmx_exit_process(struct vmx *vmx, int vc
vlapic = vm_lapic(vmx->vm, vcpu);
handled = vmx_handle_apic_write(vlapic, qual);
break;
+   case EXIT_REASON_XSETBV:
+   handled = vmx_emulate_xsetbv(vmx, vcpu);
+   break;
default:
vmm_stat_incr(vmx->vm, vcpu, VMEXIT_UNKNOWN, 1);
break;

Modified: head/sys/amd64/vmm/vmm.c
==
--- head/sys/amd64/vmm/vmm.cSat Feb  8 15:51:42 2014(r261637)
+++ head/sys/amd64/vmm/vmm.cSat Feb  8 16:37:54 2014(r261638)
@@ -89,6 +89,7 @@ struct vcpu {
struct vlapic   *vlapic;
int  vcpuid;
struct savefpu  *guestfpu;  /* guest fpu state */
+   uint64_tguest_xcr0;
void*stats;
struct vm_exit  exitinfo;
enum x2apic_state x2apic_state;
@@ -206,6 +207,7 @@ vcpu_init(struct vm *vm, uint32_t vcpu_i
vcpu->vcpuid = vcpu_id;
vcpu->vlapic = VLAPIC_INIT(vm->cookie, vcpu_id);
vm_set_x2apic_state(vm, vcpu_id, X2APIC_ENABLED);
+   vcpu->guest_xcr0 = XFEATURE_ENABLED_X87;
vcpu->guestfpu = fpu_save_area_alloc();
fpu_save_area_reset(vcpu->guestfpu);
vcpu->stats = vmm_stat_alloc();
@@ -815,6 +817,10 @@ restore_guest_fpustate(struct vcpu *vcpu
fpu_stop_emulating();
fpurestore(vcpu->guestfpu);
 
+   /* restore guest XCR0 if XSAVE is enabled in the host */
+   if (rcr4() & CR4_XSAVE)
+   load_xcr(0, vcpu->guest_xcr0);
+
/*
 * The FPU is now "dirty" with the guest's state so turn on emulation
 * to trap any access to the FPU by the host.
@@ -829,6 +835,12 @@ save_guest_fpustate(struct vcpu *vcpu)
if ((rcr0() & CR0_TS) == 0)
panic("fpu emulation not enabled in host!");
 
+   /* save guest XCR0 and restore host XCR0 */
+   if (rcr4() & CR4_XSAVE) {
+   vcpu->guest_xcr0 = rxcr(0);
+   load_xcr(0, vmm_get_host_xcr0());
+   }
+
/* save guest FPU state */
fpu_stop_emulating();
fpusave(vcpu->guestfpu);

Modified: head/sys/amd64/vmm/vmm_host.c
==
--- head/sys/amd64/vmm/vmm_host.c   Sat 

Re: svn commit: r261627 - head/sys/net

2014-02-08 Thread Adrian Chadd
Yup, it was part of the (never seemingly publicly used) kern_ API to
directly add a flowtable entry.


-a

On 8 February 2014 01:56, Gleb Smirnoff  wrote:
> Author: glebius
> Date: Sat Feb  8 09:56:26 2014
> New Revision: 261627
> URL: http://svnweb.freebsd.org/changeset/base/261627
>
> Log:
>   Remove never set flag FL_OVERWRITE. The only place where
>   it was checked led to lock/critnest leak.
>
> Modified:
>   head/sys/net/flowtable.c
>   head/sys/net/pfvar.h
>
> Modified: head/sys/net/flowtable.c
> ==
> --- head/sys/net/flowtable.cSat Feb  8 09:50:02 2014(r261626)
> +++ head/sys/net/flowtable.cSat Feb  8 09:56:26 2014(r261627)
> @@ -280,7 +280,6 @@ flowtable_pcpu_unlock(struct flowtable *
>  #define FL_ENTRY_UNLOCK(table, hash) (table)->ft_unlock((table), (hash))
>
>  #define FL_STALE   (1<<8)
> -#define FL_OVERWRITE   (1<<10)
>
>  static struct flentry *flowtable_lookup_common(struct flowtable *,
>  struct sockaddr_storage *, struct sockaddr_storage *, struct mbuf *, 
> int);
> @@ -833,8 +832,6 @@ flowtable_insert(struct flowtable *ft, u
> FL_ENTRY_UNLOCK(ft, hash);
> uma_zfree(ft->ft_zone, newfle);
>
> -   if (flags & FL_OVERWRITE)
> -   goto skip;
> return (EEXIST);
> }
> /*
>
> Modified: head/sys/net/pfvar.h
> ==
> --- head/sys/net/pfvar.hSat Feb  8 09:50:02 2014(r261626)
> +++ head/sys/net/pfvar.hSat Feb  8 09:56:26 2014(r261627)
> @@ -1580,8 +1580,6 @@ extern struct pf_src_node *pf_find_src_n
>  extern void pf_unlink_src_node(struct pf_src_node *);
>  extern void pf_unlink_src_node_locked(struct pf_src_node 
> *);
>  extern u_intpf_free_src_nodes(struct pf_src_node_list *);
> -extern void pf_print_state(struct pf_state *);
> -extern void pf_print_flags(u_int8_t);
>  extern u_int16_tpf_cksum_fixup(u_int16_t, u_int16_t, 
> u_int16_t,
> u_int8_t);
>
> @@ -1744,8 +1742,6 @@ int   pf_osfp_get(struct pf_osfp_ioctl *);
>  intpf_osfp_match(struct pf_osfp_enlist *, pf_osfp_t);
>
>  #ifdef _KERNEL
> -voidpf_print_host(struct pf_addr *, u_int16_t, u_int8_t);
> -
>  voidpf_step_into_anchor(struct pf_anchor_stackframe *, 
> int *,
> struct pf_ruleset **, int, struct pf_rule **,
> struct pf_rule **, int *);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r261639 - in head/sys: arm/freescale/vybrid boot/fdt/dts

2014-02-08 Thread Ruslan Bukin
Author: br
Date: Sat Feb  8 19:47:59 2014
New Revision: 261639
URL: http://svnweb.freebsd.org/changeset/base/261639

Log:
  Add drivers for:
  - Enhanced Direct Memory Access Controller (eDMA)
  - Direct Memory Access Multiplexer (DMAMUX)

Added:
  head/sys/arm/freescale/vybrid/vf_dmamux.c   (contents, props changed)
  head/sys/arm/freescale/vybrid/vf_dmamux.h   (contents, props changed)
  head/sys/arm/freescale/vybrid/vf_edma.c   (contents, props changed)
  head/sys/arm/freescale/vybrid/vf_edma.h   (contents, props changed)
Modified:
  head/sys/arm/freescale/vybrid/files.vybrid
  head/sys/boot/fdt/dts/vybrid.dtsi

Modified: head/sys/arm/freescale/vybrid/files.vybrid
==
--- head/sys/arm/freescale/vybrid/files.vybrid  Sat Feb  8 16:37:54 2014
(r261638)
+++ head/sys/arm/freescale/vybrid/files.vybrid  Sat Feb  8 19:47:59 2014
(r261639)
@@ -21,6 +21,8 @@ arm/freescale/vybrid/vf_anadig.c  standa
 arm/freescale/vybrid/vf_iomuxc.c   standard
 arm/freescale/vybrid/vf_mscm.c standard
 arm/freescale/vybrid/vf_src.c  standard
+arm/freescale/vybrid/vf_edma.c standard
+arm/freescale/vybrid/vf_dmamux.c   standard
 arm/freescale/vybrid/vf_tcon.c optionalvt
 arm/freescale/vybrid/vf_dcu4.c optionalvt
 arm/freescale/vybrid/vf_nfc.c  optionalnand

Added: head/sys/arm/freescale/vybrid/vf_dmamux.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/freescale/vybrid/vf_dmamux.c   Sat Feb  8 19:47:59 2014
(r261639)
@@ -0,0 +1,155 @@
+/*-
+ * Copyright (c) 2014 Ruslan Bukin 
+ * 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.
+ */
+
+/*
+ * Vybrid Family Direct Memory Access Multiplexer (DMAMUX)
+ * Chapter 22, Vybrid Reference Manual, Rev. 5, 07/2013
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#defineDMAMUX_CHCFG(n) (0x1 * n)   /* Channels 0-15 Cfg 
Reg */
+#defineCHCFG_ENBL  (1 << 7)/* Channel Enable */
+#defineCHCFG_TRIG  (1 << 6)/* Channel Trigger 
Enable */
+#defineCHCFG_SOURCE_MASK   0x3f/* Channel Source 
(Slot) */
+#defineCHCFG_SOURCE_SHIFT  0
+
+struct dmamux_softc {
+   struct resource *res[4];
+   bus_space_tag_t bst[4];
+   bus_space_handle_t  bsh[4];
+};
+
+struct dmamux_softc *dmamux_sc;
+
+static struct resource_spec dmamux_spec[] = {
+   { SYS_RES_MEMORY,   0,  RF_ACTIVE }, /* DMAMUX0 */
+   { SYS_RES_MEMORY,   1,  RF_ACTIVE }, /* DMAMUX1 */
+   { SYS_RES_MEMORY,   2,  RF_ACTIVE }, /* DMAMUX2 */
+   { SYS_RES_MEMORY,   3,  RF_ACTIVE }, /* DMAMUX3 */
+   { -1, 0 }
+};
+
+static int
+dmamux_probe(device_t dev)
+{
+
+   if (!ofw_bus_status_okay(dev))
+   return (ENXIO);
+
+   if (!ofw_bus_is_compatible(dev, "fsl,mvf600-dmamux"))
+   return (ENXIO);
+
+   device_set_desc(dev, "Vybrid Family Direct Memory Access Multiplexer");
+   return (BUS_PROBE_DEFAULT);
+}
+
+int
+dmamux_configure(int mux, int source, int channel, int enable)
+{
+   struct dmamux_softc *sc;
+   int reg;
+
+   sc = dmamux_sc;
+
+   MUX_WRITE1(sc, mux, DMAMUX_

svn commit: r261640 - head/sys/net

2014-02-08 Thread Gleb Smirnoff
Author: glebius
Date: Sat Feb  8 22:10:53 2014
New Revision: 261640
URL: http://svnweb.freebsd.org/changeset/base/261640

Log:
  Spacing.

Modified:
  head/sys/net/flowtable.c

Modified: head/sys/net/flowtable.c
==
--- head/sys/net/flowtable.cSat Feb  8 19:47:59 2014(r261639)
+++ head/sys/net/flowtable.cSat Feb  8 22:10:53 2014(r261640)
@@ -103,7 +103,7 @@ union ipv6_flow {
 struct flentry {
volatile uint32_t   f_fhash;/* hash flowing forward */
uint16_tf_flags;/* flow flags */
-   uint8_t f_pad;  
+   uint8_t f_pad;
uint8_t f_proto;/* protocol */
uint32_tf_fibnum;   /* fib index */
uint32_tf_uptime;   /* uptime at last access */
@@ -246,7 +246,7 @@ rtalloc_ign_wrapper(struct route *ro, ui
 
 static void
 flowtable_global_lock(struct flowtable *table, uint32_t hash)
-{  
+{
int lock_index = (hash)&(table->ft_lock_count - 1);
 
mtx_lock(&table->ft_locks[lock_index]);
@@ -254,7 +254,7 @@ flowtable_global_lock(struct flowtable *
 
 static void
 flowtable_global_unlock(struct flowtable *table, uint32_t hash)
-{  
+{
int lock_index = (hash)&(table->ft_lock_count - 1);
 
mtx_unlock(&table->ft_locks[lock_index]);
@@ -295,7 +295,7 @@ proto_to_flags(uint8_t proto)
break;
case IPPROTO_SCTP:
flag = FL_SCTP;
-   break;  
+   break;
case IPPROTO_UDP:
flag = FL_UDP;
break;
@@ -371,7 +371,7 @@ ipv4_mbuf_demarshal(struct mbuf *m, stru
dsin->sin_addr = ip->ip_dst;
ssin->sin_family = AF_INET;
ssin->sin_len = sizeof(*ssin);
-   ssin->sin_addr = ip->ip_src;
+   ssin->sin_addr = ip->ip_src;
 
proto = ip->ip_p;
if ((*flags & FL_HASH_ALL) == 0)
@@ -402,7 +402,7 @@ ipv4_mbuf_demarshal(struct mbuf *m, stru
return (ENOTSUP);
/* no port - hence not a protocol we care about */
break;
-   
+
}
 
 skipports:
@@ -550,7 +550,7 @@ ipv6_mbuf_demarshal(struct mbuf *m, stru
ulp = NULL;
break;
case IPPROTO_ROUTING:   /* RFC 2460 */
-   PULLUP_TO(hlen, ulp, struct ip6_rthdr); 
+   PULLUP_TO(hlen, ulp, struct ip6_rthdr);
hlen += (((struct ip6_rthdr *)ulp)->ip6r_len + 1) << 3;
proto = ((struct ip6_rthdr *)ulp)->ip6r_nxt;
ulp = NULL;
@@ -613,7 +613,7 @@ do {\
key[7] = 0; \
key[8] = 0; \
 } while (0)
-   
+
 static uint32_t
 ipv6_flow_lookup_hash(
struct sockaddr_in6 *ssin6, struct sockaddr_in6 *dsin6,
@@ -647,7 +647,7 @@ static struct flentry *
 flowtable_lookup_ipv6(struct mbuf *m)
 {
struct sockaddr_storage ssa, dsa;
-   struct sockaddr_in6 *dsin6, *ssin6; 
+   struct sockaddr_in6 *dsin6, *ssin6;
uint16_t flags;
 
dsin6 = (struct sockaddr_in6 *)&dsa;
@@ -655,7 +655,7 @@ flowtable_lookup_ipv6(struct mbuf *m)
bzero(dsin6, sizeof(*dsin6));
bzero(ssin6, sizeof(*ssin6));
flags = V_ip6_ft.ft_flags;
-   
+
if (ipv6_mbuf_demarshal(m, ssin6, dsin6, &flags) != 0)
return (NULL);
 
@@ -706,7 +706,7 @@ flowtable_entry(struct flowtable *ft, ui
KASSERT(&ft->ft_table.global[0] != NULL, ("global not set"));
fle = &ft->ft_table.global[index];
}
-   
+
return (fle);
 }
 
@@ -754,7 +754,7 @@ flowtable_set_hashkey(struct flentry *fl
nwords = 3;
hashkey = ((struct flentry_v6 *)fle)->fl_flow.ipf_key;
}
-   
+
for (i = 0; i < nwords; i++)
hashkey[i] = key[i];
 }
@@ -764,7 +764,7 @@ flow_full(struct flowtable *ft)
 {
boolean_t full;
int count, max;
-   
+
full = ft->ft_full;
count = uma_zone_get_cur(ft->ft_zone);
max = uma_zone_get_max(ft->ft_zone);
@@ -773,7 +773,7 @@ flow_full(struct flowtable *ft)
ft->ft_full = FALSE;
else if (!full && (count > (max - (max >> 5
ft->ft_full = TRUE;
-   
+
if (full && !ft->ft_full) {
flowclean_freq = 4*hz;
if ((ft->ft_flags & FL_HASH_ALL) == 0)
@@ -816,7 +816,7 @@ flowtable_insert(struct flowtable *ft, u
*flep = fle = newfle;
goto skip;
}
-   
+
depth = 0;
FLOWSTAT_INC(ft, ft_collisions);
/*
@@ -831,7 +831,7 @@ flowtable_insert(struct flowtable *ft, u
 */
FL_ENTRY_UNLOCK(ft, hash);
 

svn commit: r261641 - head/sys/net

2014-02-08 Thread Gleb Smirnoff
Author: glebius
Date: Sat Feb  8 22:12:00 2014
New Revision: 261641
URL: http://svnweb.freebsd.org/changeset/base/261641

Log:
  Remove ft_rtalloc and choose rtalloc function at compile time.

Modified:
  head/sys/net/flowtable.c

Modified: head/sys/net/flowtable.c
==
--- head/sys/net/flowtable.cSat Feb  8 22:10:53 2014(r261640)
+++ head/sys/net/flowtable.cSat Feb  8 22:12:00 2014(r261641)
@@ -132,7 +132,6 @@ struct flentry_v6 {
 
 
 typedefvoid fl_lock_t(struct flowtable *, uint32_t);
-typedef void fl_rtalloc_t(struct route *, uint32_t, u_int);
 
 union flentryp {
struct flentry  **global;
@@ -148,7 +147,6 @@ struct flowtable {
uint32_tft_max_depth;
fl_lock_t   *ft_lock;
fl_lock_t   *ft_unlock;
-   fl_rtalloc_t*ft_rtalloc;
/*
 * XXX need to pad out
 */
@@ -235,15 +233,6 @@ SYSCTL_VNET_INT(_net_flowtable, OID_AUTO
 &VNET_NAME(flowtable_tcp_expire), 0,
 "seconds after which to remove flow allocated to a TCP connection.");
 
-#ifndef RADIX_MPATH
-static void
-rtalloc_ign_wrapper(struct route *ro, uint32_t hash, u_int fibnum)
-{
-
-   rtalloc_ign_fib(ro, 0, fibnum);
-}
-#endif
-
 static void
 flowtable_global_lock(struct flowtable *table, uint32_t hash)
 {
@@ -1029,7 +1018,12 @@ uncached:
 * receive the route locked
 */
 
-   ft->ft_rtalloc(ro, hash, fibnum);
+#ifdef RADIX_MPATH
+   rtalloc_mpath_fib(ro, hash, fibnum);
+#else
+   rtalloc_ign_fib(ro, 0, fibnum);
+#endif
+
if (ro->ro_rt == NULL)
return (NULL);
 
@@ -1100,11 +1094,6 @@ static void
 flowtable_alloc(struct flowtable *ft)
 {
 
-#ifdef RADIX_MPATH
-   ft->ft_rtalloc = rtalloc_mpath_fib;
-#else
-   ft->ft_rtalloc = rtalloc_ign_wrapper;
-#endif
if (ft->ft_flags & FL_PCPU) {
ft->ft_lock = flowtable_pcpu_lock;
ft->ft_unlock = flowtable_pcpu_unlock;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r261642 - in head/sys: arm/arm arm/conf arm/include arm/xscale/i80321 arm/xscale/i8134x arm/xscale/ixp425 arm/xscale/pxa conf

2014-02-08 Thread Ian Lepore
Author: ian
Date: Sat Feb  8 22:21:38 2014
New Revision: 261642
URL: http://svnweb.freebsd.org/changeset/base/261642

Log:
  Remove the ARM_USE_SMALL_ALLOC option and code related to it.
  
  This was an optimization used only by a few xscale platforms.  Part of
  the optimization was to create a direct map for all physical pages, and
  that resulted in making multiple mappings of pages in a way that bypassed
  the logic in pmap.c to handle VIVT cache aliasing.  It also just generally
  made the code more complex and hard to maintain for all SoCs.
  
  Reviewed by:  cognet

Modified:
  head/sys/arm/arm/machdep.c
  head/sys/arm/arm/mem.c
  head/sys/arm/arm/pmap.c
  head/sys/arm/arm/vm_machdep.c
  head/sys/arm/conf/AVILA
  head/sys/arm/conf/CAMBRIA
  head/sys/arm/conf/CNS11XXNAS
  head/sys/arm/conf/CRB
  head/sys/arm/conf/EP80219
  head/sys/arm/conf/IQ31244
  head/sys/arm/conf/NSLU
  head/sys/arm/include/pmap.h
  head/sys/arm/include/sf_buf.h
  head/sys/arm/include/vmparam.h
  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
  head/sys/arm/xscale/pxa/std.pxa
  head/sys/conf/options.arm

Modified: head/sys/arm/arm/machdep.c
==
--- head/sys/arm/arm/machdep.c  Sat Feb  8 22:12:00 2014(r261641)
+++ head/sys/arm/arm/machdep.c  Sat Feb  8 22:21:38 2014(r261642)
@@ -783,9 +783,6 @@ makectx(struct trapframe *tf, struct pcb
  * Make a standard dump_avail array.  Can't make the phys_avail
  * since we need to do that after we call pmap_bootstrap, but this
  * is needed before pmap_boostrap.
- *
- * ARM_USE_SMALL_ALLOC uses dump_avail, so it must be filled before
- * calling pmap_bootstrap.
  */
 void
 arm_dump_avail_init(vm_paddr_t physaddr, vm_offset_t ramsize, size_t max)

Modified: head/sys/arm/arm/mem.c
==
--- head/sys/arm/arm/mem.c  Sat Feb  8 22:12:00 2014(r261641)
+++ head/sys/arm/arm/mem.c  Sat Feb  8 22:21:38 2014(r261642)
@@ -135,10 +135,6 @@ memrw(struct cdev *dev, struct uio *uio,
if (!kernacc((caddr_t)(int)uio->uio_offset, c,
uio->uio_rw == UIO_READ ?
VM_PROT_READ : VM_PROT_WRITE))
-#ifdef ARM_USE_SMALL_ALLOC
-   if (addr <= VM_MAXUSER_ADDRESS ||
-   addr >= KERNBASE)
-#endif
return (EFAULT);
error = uiomove((caddr_t)(int)uio->uio_offset, (int)c, 
uio);
continue;

Modified: head/sys/arm/arm/pmap.c
==
--- head/sys/arm/arm/pmap.c Sat Feb  8 22:12:00 2014(r261641)
+++ head/sys/arm/arm/pmap.c Sat Feb  8 22:21:38 2014(r261642)
@@ -1069,9 +1069,7 @@ pmap_l2ptp_ctor(void *mem, int size, voi
 #ifndef PMAP_INCLUDE_PTE_SYNC
struct l2_bucket *l2b;
pt_entry_t *ptep, pte;
-#ifdef ARM_USE_SMALL_ALLOC
-   pd_entry_t *pde;
-#endif
+
vm_offset_t va = (vm_offset_t)mem & ~PAGE_MASK;
 
/*
@@ -1082,10 +1080,6 @@ pmap_l2ptp_ctor(void *mem, int size, voi
 * page tables, we simply fix up the cache-mode here if it's not
 * correct.
 */
-#ifdef ARM_USE_SMALL_ALLOC
-   pde = &kernel_pmap->pm_l1->l1_kva[L1_IDX(va)];
-   if (!l1pte_section_p(*pde)) {
-#endif
l2b = pmap_get_l2_bucket(pmap_kernel(), va);
ptep = &l2b->l2b_kva[l2pte_index(va)];
pte = *ptep;
@@ -1100,9 +1094,6 @@ pmap_l2ptp_ctor(void *mem, int size, voi
cpu_tlb_flushD_SE(va);
cpu_cpwait();
}
-#ifdef ARM_USE_SMALL_ALLOC
-   }
-#endif
 #endif
memset(mem, 0, L2_TABLE_SIZE_REAL);
PTE_SYNC_RANGE(mem, L2_TABLE_SIZE_REAL / sizeof(pt_entry_t));
@@ -2259,10 +2250,6 @@ pmap_alloc_specials(vm_offset_t *availp,
  * (physical) address starting relative to 0]
  */
 #define PMAP_STATIC_L2_SIZE 16
-#ifdef ARM_USE_SMALL_ALLOC
-extern struct mtx smallalloc_mtx;
-#endif
-
 void
 pmap_bootstrap(vm_offset_t firstaddr, struct pv_addr *l1pt)
 {
@@ -2422,10 +2409,6 @@ pmap_bootstrap(vm_offset_t firstaddr, st
kernel_vm_end = pmap_curmaxkvaddr;
mtx_init(&cmtx, "TMP mappings mtx", NULL, MTX_DEF);
 
-#ifdef ARM_USE_SMALL_ALLOC
-   mtx_init(&smallalloc_mtx, "Small alloc page list", NULL, MTX_DEF);
-   arm_init_smallalloc();
-#endif
pmap_set_pcb_pagedir(kernel_pmap, thread0.td_pcb);
 }
 
@@ -2669,11 +2652,7 @@ pmap_remove_pages(pmap_t pmap)
KASSERT(l2b != NULL, ("No L2 bucket in pmap_remove_pages"));
pt = &l2b->l2b_kva[l2pte_index(pv->pv_va)];
m

svn commit: r261643 - in head/sys: arm/arm arm/at91 arm/econa arm/include arm/s3c2xx0 arm/sa11x0 arm/xscale/i80321 arm/xscale/i8134x arm/xscale/ixp425 arm/xscale/pxa conf

2014-02-08 Thread Ian Lepore
Author: ian
Date: Sat Feb  8 23:54:16 2014
New Revision: 261643
URL: http://svnweb.freebsd.org/changeset/base/261643

Log:
  Consolidate code related to setting up physical memory configuration into
  a new physmem.c file.  The new code provides helper routines that can be
  used by legacy SoCs and newer FDT-based systems.  There are routines to
  add one or more regions of physically contiguous ram, and exclude one or
  more physically contiguous regions of ram.  Ram can be excluded from crash
  dumps, from being given over to the vm system for allocation management,
  or both.  After all the included and excluded regions have been added,
  arm_physmem_init_kernel_globals() processes the regions into the global
  dump_avail and phys_avail arrays and realmem and physmem variables that
  communicate memory configuration to the rest of the kernel.
  
  Convert all existing SoCs to use the new helper code.

Added:
  head/sys/arm/arm/physmem.c   (contents, props changed)
  head/sys/arm/include/physmem.h   (contents, props changed)
Modified:
  head/sys/arm/arm/machdep.c
  head/sys/arm/at91/at91_machdep.c
  head/sys/arm/econa/econa_machdep.c
  head/sys/arm/include/machdep.h
  head/sys/arm/s3c2xx0/s3c24x0_machdep.c
  head/sys/arm/sa11x0/assabet_machdep.c
  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
  head/sys/conf/files.arm

Modified: head/sys/arm/arm/machdep.c
==
--- head/sys/arm/arm/machdep.c  Sat Feb  8 22:21:38 2014(r261642)
+++ head/sys/arm/arm/machdep.c  Sat Feb  8 23:54:16 2014(r261643)
@@ -97,6 +97,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -122,8 +123,6 @@ uint32_t cpu_reset_address = 0;
 int cold = 1;
 vm_offset_t vector_page;
 
-long realmem = 0;
-
 int (*_arm_memcpy)(void *, void *, int, int) = NULL;
 int (*_arm_bzero)(void *, int, int) = NULL;
 int _min_memcpy_size = 0;
@@ -144,9 +143,6 @@ extern vm_offset_t ksym_start, ksym_end;
 
 static struct pv_addr kernel_pt_table[KERNEL_PT_MAX];
 
-vm_paddr_t phys_avail[10];
-vm_paddr_t dump_avail[4];
-
 extern u_int data_abort_handler_address;
 extern u_int prefetch_abort_handler_address;
 extern u_int undefined_handler_address;
@@ -356,6 +352,7 @@ static void
 cpu_startup(void *dummy)
 {
struct pcb *pcb = thread0.td_pcb;
+   const unsigned int mbyte = 1024 * 1024;
 #ifdef ARM_TP_ADDRESS
 #ifndef ARM_CACHE_LOCK_ENABLE
vm_page_t m;
@@ -364,36 +361,21 @@ cpu_startup(void *dummy)
 
identify_arm_cpu();
 
-   printf("real memory  = %ju (%ju MB)\n", (uintmax_t)ptoa(physmem),
-   (uintmax_t)ptoa(physmem) / 1048576);
-   realmem = physmem;
+   vm_ksubmap_init(&kmi);
 
/*
 * Display the RAM layout.
 */
-   if (bootverbose) {
-   int indx;
-
-   printf("Physical memory chunk(s):\n");
-   for (indx = 0; phys_avail[indx + 1] != 0; indx += 2) {
-   vm_paddr_t size;
-
-   size = phys_avail[indx + 1] - phys_avail[indx];
-   printf("  0x%08jx - 0x%08jx, %ju KBytes (%ju pages)\n",
-   (uintmax_t)phys_avail[indx],
-   (uintmax_t)phys_avail[indx + 1] - 1,
-   (uintmax_t)size / 1024, (uintmax_t)size / 
PAGE_SIZE);
-   }
-   }
-
-   vm_ksubmap_init(&kmi);
-
+   printf("real memory  = %ju (%ju MB)\n", 
+   (uintmax_t)arm32_ptob(realmem),
+   (uintmax_t)arm32_ptob(realmem) / mbyte);
printf("avail memory = %ju (%ju MB)\n",
-   (uintmax_t)ptoa(cnt.v_free_count),
-   (uintmax_t)ptoa(cnt.v_free_count) / 1048576);
-
-   if (bootverbose)
+   (uintmax_t)arm32_ptob(cnt.v_free_count),
+   (uintmax_t)arm32_ptob(cnt.v_free_count) / mbyte);
+   if (bootverbose) {
+   arm_physmem_print_tables();
arm_devmap_print_table();
+   }
 
bufinit();
vm_pager_bufferinit();
@@ -780,44 +762,6 @@ makectx(struct trapframe *tf, struct pcb
 }
 
 /*
- * Make a standard dump_avail array.  Can't make the phys_avail
- * since we need to do that after we call pmap_bootstrap, but this
- * is needed before pmap_boostrap.
- */
-void
-arm_dump_avail_init(vm_paddr_t physaddr, vm_offset_t ramsize, size_t max)
-{
-#ifdef LINUX_BOOT_ABI
-   /*
-* Linux boot loader passes us the actual banks of memory, so use them
-* to construct the dump_avail array.
-*/
-   if (membanks > 0) 
-   {
-   int i, j;
-
-   if (max < (membanks + 1) * 2)
-   panic("dump_avail[%d] too small for %d banks\n",
-   max, membanks);
-   fo

svn commit: r261646 - in head/sys/arm: at91 econa s3c2xx0 xscale/ixp425

2014-02-08 Thread Ian Lepore
Author: ian
Date: Sun Feb  9 01:21:30 2014
New Revision: 261646
URL: http://svnweb.freebsd.org/changeset/base/261646

Log:
  Replace compile-time constant KERNPHYSADDR with abp_physaddr (determined
  at runtime) where it's trivial to do so.  Another breadcrumb on the trail
  to a kernel that can be loaded at any 1MB boundary.

Modified:
  head/sys/arm/at91/at91_machdep.c
  head/sys/arm/econa/econa_machdep.c
  head/sys/arm/s3c2xx0/s3c24x0_machdep.c
  head/sys/arm/xscale/ixp425/avila_machdep.c

Modified: head/sys/arm/at91/at91_machdep.c
==
--- head/sys/arm/at91/at91_machdep.cSun Feb  9 00:37:16 2014
(r261645)
+++ head/sys/arm/at91/at91_machdep.cSun Feb  9 01:21:30 2014
(r261646)
@@ -471,7 +471,7 @@ initarm(struct arm_boot_params *abp)
/* Define a macro to simplify memory allocation */
 #define valloc_pages(var, np)  \
alloc_pages((var).pv_va, (np)); \
-   (var).pv_pa = (var).pv_va + (KERNPHYSADDR - KERNVIRTADDR);
+   (var).pv_pa = (var).pv_va + (abp->abp_physaddr - KERNVIRTADDR);
 
 #define alloc_pages(var, np)   \
(var) = freemempos; \
@@ -491,7 +491,7 @@ initarm(struct arm_boot_params *abp)
L2_TABLE_SIZE_REAL;
kernel_pt_table[i].pv_pa =
kernel_pt_table[i].pv_va - KERNVIRTADDR +
-   KERNPHYSADDR;
+   abp->abp_physaddr;
}
}
/*

Modified: head/sys/arm/econa/econa_machdep.c
==
--- head/sys/arm/econa/econa_machdep.c  Sun Feb  9 00:37:16 2014
(r261645)
+++ head/sys/arm/econa/econa_machdep.c  Sun Feb  9 01:21:30 2014
(r261646)
@@ -189,7 +189,7 @@ initarm(struct arm_boot_params *abp)
/* Define a macro to simplify memory allocation */
 #definevalloc_pages(var, np)   \
alloc_pages((var).pv_va, (np)); \
-   (var).pv_pa = (var).pv_va + (KERNPHYSADDR - KERNVIRTADDR);
+   (var).pv_pa = (var).pv_va + (abp->abp_physaddr - KERNVIRTADDR);
 
 #definealloc_pages(var, np)\
(var) = freemempos; \
@@ -209,7 +209,7 @@ initarm(struct arm_boot_params *abp)
L2_TABLE_SIZE_REAL;
kernel_pt_table[loop].pv_pa =
kernel_pt_table[loop].pv_va - KERNVIRTADDR +
-   KERNPHYSADDR;
+   abp->abp_physaddr;
}
}
/*

Modified: head/sys/arm/s3c2xx0/s3c24x0_machdep.c
==
--- head/sys/arm/s3c2xx0/s3c24x0_machdep.c  Sun Feb  9 00:37:16 2014
(r261645)
+++ head/sys/arm/s3c2xx0/s3c24x0_machdep.c  Sun Feb  9 01:21:30 2014
(r261646)
@@ -239,7 +239,7 @@ initarm(struct arm_boot_params *abp)
/* Define a macro to simplify memory allocation */
 #define valloc_pages(var, np)  \
alloc_pages((var).pv_va, (np)); \
-   (var).pv_pa = (var).pv_va + (KERNPHYSADDR - KERNVIRTADDR);
+   (var).pv_pa = (var).pv_va + (abp->abp_physaddr - KERNVIRTADDR);
 
 #define alloc_pages(var, np)   \
(var) = freemempos; \
@@ -259,7 +259,7 @@ initarm(struct arm_boot_params *abp)
L2_TABLE_SIZE_REAL;
kernel_pt_table[loop].pv_pa =
kernel_pt_table[loop].pv_va - KERNVIRTADDR +
-   KERNPHYSADDR;
+   abp->abp_physaddr;
}
}
/*

Modified: head/sys/arm/xscale/ixp425/avila_machdep.c
==
--- head/sys/arm/xscale/ixp425/avila_machdep.c  Sun Feb  9 00:37:16 2014
(r261645)
+++ head/sys/arm/xscale/ixp425/avila_machdep.c  Sun Feb  9 01:21:30 2014
(r261646)
@@ -92,11 +92,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-/* kernel text starts where we were loaded at boot */
-#defineKERNEL_TEXT_OFF (KERNPHYSADDR  - PHYSADDR)
-#defineKERNEL_TEXT_BASE(KERNBASE + KERNEL_TEXT_OFF)
-#defineKERNEL_TEXT_PHYS(PHYSADDR + KERNEL_TEXT_OFF)
-
 #define KERNEL_PT_SYS  0   /* Page table for mapping proc0 zero 
page */
 #defineKERNEL_PT_IO1
 #define KERNEL_PT_IO_NUM   3
@@ -221,6 +216,11 @@ initarm(struct arm_boot_params *abp)
vm_offset_t lastaddr;
uint32_t memsize;
 
+   /* kernel text starts where we were loaded at boot */
+#defineKERNEL_TEXT_OFF (abp->abp_physaddr  - PHYSADDR)
+#defin

svn commit: r261647 - head/sys/vm

2014-02-08 Thread Alan Cox
Author: alc
Date: Sun Feb  9 01:59:52 2014
New Revision: 261647
URL: http://svnweb.freebsd.org/changeset/base/261647

Log:
  Don't call vm_fault_prefault() on zero-fill faults.  It's a waste of time.
  Successful prefaults after a zero-fill fault are extremely rare.

Modified:
  head/sys/vm/vm_fault.c

Modified: head/sys/vm/vm_fault.c
==
--- head/sys/vm/vm_fault.c  Sun Feb  9 01:21:30 2014(r261646)
+++ head/sys/vm/vm_fault.c  Sun Feb  9 01:59:52 2014(r261647)
@@ -652,6 +652,8 @@ vnode_locked:
}
PCPU_INC(cnt.v_zfod);
fs.m->valid = VM_PAGE_BITS_ALL;
+   /* Don't try to prefault neighboring pages. */
+   faultcount = 1;
break;  /* break to PAGE HAS BEEN FOUND */
} else {
KASSERT(fs.object != next_object,
@@ -897,7 +899,8 @@ vnode_locked:
 * won't find it (yet).
 */
pmap_enter(fs.map->pmap, vaddr, fault_type, fs.m, prot, wired);
-   if ((fault_flags & VM_FAULT_CHANGE_WIRING) == 0 && wired == 0)
+   if (faultcount != 1 && (fault_flags & VM_FAULT_CHANGE_WIRING) == 0 &&
+   wired == 0)
vm_fault_prefault(&fs, vaddr, faultcount, reqpage);
VM_OBJECT_WLOCK(fs.object);
vm_page_lock(fs.m);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2014-02-08 Thread Ian Lepore
Author: ian
Date: Sun Feb  9 02:06:12 2014
New Revision: 261648
URL: http://svnweb.freebsd.org/changeset/base/261648

Log:
  Calculate the kernel's load address from the PC in the elf / gzip
  trampoline instead of relying on KERNPHYSADDR as a compile-time constant.

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

Modified: head/sys/arm/arm/elf_trampoline.c
==
--- head/sys/arm/arm/elf_trampoline.c   Sun Feb  9 01:59:52 2014
(r261647)
+++ head/sys/arm/arm/elf_trampoline.c   Sun Feb  9 02:06:12 2014
(r261648)
@@ -186,14 +186,20 @@ static void arm9_setup(void);
 void
 _startC(void)
 {
-   int physaddr = KERNPHYSADDR;
int tmp1;
unsigned int sp = ((unsigned int)&_end & ~3) + 4;
-#if defined(FLASHADDR) && defined(PHYSADDR) && defined(LOADERRAMADDR)
-   unsigned int pc;
+   unsigned int pc, kernphysaddr;
 
+   /*
+* Figure out the physical address the kernel was loaded at.  This
+* assumes the entry point (this code right here) is in the first page,
+* which will always be the case for this trampoline code.
+*/
__asm __volatile("mov %0, pc\n"
: "=r" (pc));
+   kernphysaddr = pc & ~PAGE_MASK;
+
+#if defined(FLASHADDR) && defined(PHYSADDR) && defined(LOADERRAMADDR)
if ((FLASHADDR > LOADERRAMADDR && pc >= FLASHADDR) ||
(FLASHADDR < LOADERRAMADDR && pc < LOADERRAMADDR)) {
/*
@@ -247,7 +253,7 @@ _startC(void)
 "mov pc, %0\n"
 "2: nop\n"
 "mov sp, %2\n"
-: "=r" (tmp1), "+r" (physaddr), "+r" (sp));
+: "=r" (tmp1), "+r" (kernphysaddr), "+r" (sp));
 #ifndef KZIP
 #ifdef CPU_ARM9
/* So that idcache_wbinv works; */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r261649 - in head/sys/arm: arm at91 econa include s3c2xx0 sa11x0 xscale/i80321 xscale/i8134x xscale/ixp425 xscale/pxa

2014-02-08 Thread Ian Lepore
Author: ian
Date: Sun Feb  9 02:39:00 2014
New Revision: 261649
URL: http://svnweb.freebsd.org/changeset/base/261649

Log:
  It turns out a global variable is the only straightforward way to
  communicate the kernel's physical load address from where it's known in
  initarm() into cpu_mp_start() which is called from non-arm code and
  takes no parameters.
  
  This adds the global variable and ensures that all the various copies
  of initarm() set it.  It uses the variable in cpu_mp_start(), eliminating
  the last uses of KERNPHYSADDR outside of locore.S (where we can now
  calculate it instead of relying on the constant).

Modified:
  head/sys/arm/arm/machdep.c
  head/sys/arm/arm/mp_machdep.c
  head/sys/arm/arm/physmem.c
  head/sys/arm/at91/at91_machdep.c
  head/sys/arm/econa/econa_machdep.c
  head/sys/arm/include/physmem.h
  head/sys/arm/s3c2xx0/s3c24x0_machdep.c
  head/sys/arm/sa11x0/assabet_machdep.c
  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/arm/machdep.c
==
--- head/sys/arm/arm/machdep.c  Sun Feb  9 02:06:12 2014(r261648)
+++ head/sys/arm/arm/machdep.c  Sun Feb  9 02:39:00 2014(r261649)
@@ -1032,6 +1032,8 @@ initarm(struct arm_boot_params *abp)
int i, j, err_devmap, mem_regions_sz;
 
lastaddr = parse_boot_param(abp);
+   arm_physmem_kernaddr = abp->abp_physaddr;
+
memsize = 0;
set_cpufuncs();
 

Modified: head/sys/arm/arm/mp_machdep.c
==
--- head/sys/arm/arm/mp_machdep.c   Sun Feb  9 02:06:12 2014
(r261648)
+++ head/sys/arm/arm/mp_machdep.c   Sun Feb  9 02:39:00 2014
(r261649)
@@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #ifdef VFP
@@ -120,16 +121,16 @@ cpu_mp_start(void)
M_WAITOK | M_ZERO);
temp_pagetable_va = (vm_offset_t)contigmalloc(L1_TABLE_SIZE,
M_TEMP, 0, 0x0, 0x, L1_TABLE_SIZE, 0);
-   addr = KERNPHYSADDR;
-   addr_end = (vm_offset_t)&_end - KERNVIRTADDR + KERNPHYSADDR;
+   addr = arm_physmem_kernaddr;
+   addr_end = (vm_offset_t)&_end - KERNVIRTADDR + arm_physmem_kernaddr;
addr_end &= ~L1_S_OFFSET;
addr_end += L1_S_SIZE;
bzero((void *)temp_pagetable_va,  L1_TABLE_SIZE);
-   for (addr = KERNPHYSADDR; addr <= addr_end; addr += L1_S_SIZE) { 
+   for (addr = arm_physmem_kernaddr; addr <= addr_end; addr += L1_S_SIZE) 
{ 
((int *)(temp_pagetable_va))[addr >> L1_S_SHIFT] =

L1_TYPE_S|L1_SHARED|L1_S_C|L1_S_AP(AP_KRW)|L1_S_DOM(PMAP_DOMAIN_KERNEL)|addr;
((int *)(temp_pagetable_va))[(addr -
-   KERNPHYSADDR + KERNVIRTADDR) >> L1_S_SHIFT] = 
+   arm_physmem_kernaddr + KERNVIRTADDR) >> L1_S_SHIFT] = 

L1_TYPE_S|L1_SHARED|L1_S_C|L1_S_AP(AP_KRW)|L1_S_DOM(PMAP_DOMAIN_KERNEL)|addr;
}
 

Modified: head/sys/arm/arm/physmem.c
==
--- head/sys/arm/arm/physmem.c  Sun Feb  9 02:06:12 2014(r261648)
+++ head/sys/arm/arm/physmem.c  Sun Feb  9 02:39:00 2014(r261649)
@@ -89,6 +89,9 @@ vm_paddr_t dump_avail[MAX_AVAIL_ENTRIES 
 /* This is the total number of hardware pages, excluded or not. */
 long realmem;
 
+/* The address at which the kernel was loaded.  Set early in initarm(). */
+vm_offset_t arm_physmem_kernaddr;
+
 /*
  * Print the contents of the physical and excluded region tables using the
  * provided printf-like output function (which will be either printf or

Modified: head/sys/arm/at91/at91_machdep.c
==
--- head/sys/arm/at91/at91_machdep.cSun Feb  9 02:06:12 2014
(r261648)
+++ head/sys/arm/at91/at91_machdep.cSun Feb  9 02:39:00 2014
(r261649)
@@ -461,6 +461,7 @@ initarm(struct arm_boot_params *abp)
vm_offset_t lastaddr;
 
lastaddr = parse_boot_param(abp);
+   arm_physmem_kernaddr = abp->abp_physaddr;
set_cpufuncs();
pcpu0_init();
 

Modified: head/sys/arm/econa/econa_machdep.c
==
--- head/sys/arm/econa/econa_machdep.c  Sun Feb  9 02:06:12 2014
(r261648)
+++ head/sys/arm/econa/econa_machdep.c  Sun Feb  9 02:39:00 2014
(r261649)
@@ -178,6 +178,7 @@ initarm(struct arm_boot_params *abp)
 
boothowto = RB_VERBOSE;
lastaddr = parse_boot_param(abp);
+   arm_physmem_kernaddr = abp->abp_physaddr;
set_cpufuncs();
pcpu0_init();
 

Modified: head/sys/arm/include/physmem.h
===