Commit Graph

2441 Commits

Author SHA1 Message Date
tls 7b0b7dedd9 Entropy-pool implementation move and cleanup.
1) Move core entropy-pool code and source/sink/sample management code
   to sys/kern from sys/dev.

2) Remove use of NRND as test for presence of entropy-pool code throughout
   source tree.

3) Remove use of RND_ENABLED in device drivers as microoptimization to
   avoid expensive operations on disabled entropy sources; make the
   rnd_add calls do this directly so all callers benefit.

4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
   have lead to slight entropy overestimation for some sources.

5) Add new source types for environmental sensors, power sensors, VM
   system events, and skew between clocks, with a sample implementation
   for each.

ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files).  Tested with release
builds on amd64 and evbarm and live testing on amd64.
2012-02-02 19:42:57 +00:00
para 3eed4a3cfa - bringing kmeminit_nkmempages back and revert pmaps that called this early
- use nkmempages to scale the kmem_arena
- reducing diff to pre kmem/vmem change
   (NKMEMPAGES_MAX_DEFAULT will need adjusting on some archs)
2012-02-02 18:59:44 +00:00
matt c97a1e79d0 Add ALIGNBYTES32/ALIGN32 for netbsd32. 2012-02-01 02:05:51 +00:00
matt 645c524104 Fix early console support. 2012-02-01 02:05:14 +00:00
para e62ee4d475 extending vmem(9) to be able to allocated resources for it's own needs.
simplifying uvm_map handling (no special kernel entries anymore no relocking)
make malloc(9) a thin wrapper around kmem(9)
(with private interface for interrupt safety reasons)

releng@ acknowledged
2012-01-27 19:48:38 +00:00
para 89c9828deb converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged
2012-01-27 18:52:47 +00:00
matt e5323fccec Let mips_pmap_{,un}map_poolpage do the translation work. 2012-01-26 02:14:08 +00:00
christos dd23e71080 Use and define ALIGN() ALIGN_POINTER() and STACK_ALIGN() consistently,
and avoid definining them in 10 different places if not needed.
2012-01-24 20:03:36 +00:00
joerg e8bec33be1 Change CMSG_SPACE and CMSG_LEN to provide Integer Constant Expressions
again. This was changed in sys/socket.h r1.51 to work around fallout
from the IPv6 aux data migration. It broke the historic ABI on some
platforms. This commit restores compatibility for netbsd32 code on such
platforms and provides a template for future changes to the CMSG_*
alignment. Revert PCC/Clang workarounds in postfix and tmux.
2012-01-20 14:08:04 +00:00
matt 329ec0ace4 Add ALIGNBYTES32/ALIGN32 (same as ALIGNBYTES/ALIGN). 2012-01-19 20:55:38 +00:00
kiyohara c3832bc16f + Fix IPL_VM sr_bits for alchemy_ipl_sr_map. Alchemy peripherals connects to
MIPS_INT_MASK_[0-3].
+ Also add IPL_DDB.
2012-01-14 16:09:19 +00:00
kiyohara 133bfd2508 Use device_t instead of 'struct device *'.
Remove unnecessary \n.
2012-01-04 02:36:26 +00:00
kiyohara f58fcf6acf Use device_t instead of 'struct device *'.
Call aprint_* in auto-config time.
2012-01-03 07:36:02 +00:00
kiyohara 66f37ec687 Fix TLB-miss. Don't overwrite t0 before use. 2011-12-25 11:51:15 +00:00
tsutsui bf759fcc29 - use correct ASID bits in MIPS_COP_0_TLB_HI
- save/restore current PID in tlb_invalidate_all() and cpu_switch_resume()
  as mipsX_subr.S does
2011-12-23 10:01:33 +00:00
macallan e89302ed7b add a hook to mips3_initclocks() to allow for time counters other than the
cp0 cycle counter
2011-12-13 14:23:43 +00:00
mrg 9a4a666ff3 implement bdev_size(9) wrapper around d_psize() routine, so we can take
the device lock in relevant places.  avoid doing so while actually dumping.

tested i386 crash dumps still work, and that all touched files compile.

fixes PR#45705.
2011-12-12 19:03:07 +00:00
matt 6cf0f4774c Print out the address in the ktlbmod panic. 2011-11-24 04:17:46 +00:00
matt c144a79507 Add workaround for RMI cpus (not really needed but good for completeness) 2011-11-24 04:17:11 +00:00
tls 3afd44cf08 First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>.  This change includes
the following:

	An initial cleanup and minor reorganization of the entropy pool
	code in sys/dev/rnd.c and sys/dev/rndpool.c.  Several bugs are
	fixed.  Some effort is made to accumulate entropy more quickly at
	boot time.

	A generic interface, "rndsink", is added, for stream generators to
	request that they be re-keyed with good quality entropy from the pool
	as soon as it is available.

	The arc4random()/arc4randbytes() implementation in libkern is
	adjusted to use the rndsink interface for rekeying, which helps
	address the problem of low-quality keys at boot time.

	An implementation of the FIPS 140-2 statistical tests for random
	number generator quality is provided (libkern/rngtest.c).  This
	is based on Greg Rose's implementation from Qualcomm.

	A new random stream generator, nist_ctr_drbg, is provided.  It is
	based on an implementation of the NIST SP800-90 CTR_DRBG by
	Henric Jungheim.  This generator users AES in a modified counter
	mode to generate a backtracking-resistant random stream.

	An abstraction layer, "cprng", is provided for in-kernel consumers
	of randomness.  The arc4random/arc4randbytes API is deprecated for
	in-kernel use.  It is replaced by "cprng_strong".  The current
	cprng_fast implementation wraps the existing arc4random
	implementation.  The current cprng_strong implementation wraps the
	new CTR_DRBG implementation.  Both interfaces are rekeyed from
	the entropy pool automatically at intervals justifiable from best
	current cryptographic practice.

	In some quick tests, cprng_fast() is about the same speed as
	the old arc4randbytes(), and cprng_strong() is about 20% faster
	than rnd_extract_data().  Performance is expected to improve.

	The AES code in src/crypto/rijndael is no longer an optional
	kernel component, as it is required by cprng_strong, which is
	not an optional kernel component.

	The entropy pool output is subjected to the rngtest tests at
	startup time; if it fails, the system will reboot.  There is
	approximately a 3/10000 chance of a false positive from these
	tests.  Entropy pool _input_ from hardware random numbers is
	subjected to the rngtest tests at attach time, as well as the
	FIPS continuous-output test, to detect bad or stuck hardware
	RNGs; if any are detected, they are detached, but the system
	continues to run.

	A problem with rndctl(8) is fixed -- datastructures with
	pointers in arrays are no longer passed to userspace (this
	was not a security problem, but rather a major issue for
	compat32).  A new kernel will require a new rndctl.

	The sysctl kern.arandom() and kern.urandom() nodes are hooked
	up to the new generators, but the /dev/*random pseudodevices
	are not, yet.

	Manual pages for the new kernel interfaces are forthcoming.
2011-11-19 22:51:18 +00:00
tsutsui 2556fadeae Read-modify-write instead of read-modify-read. (not sure if this was fatal) 2011-11-13 15:57:57 +00:00
joerg f02d1cc2e1 Don't redefine _C_LABEL. 2011-11-10 00:37:38 +00:00
matt 41adc9f5c2 Make sure to invalidate correct size. 2011-11-09 17:05:50 +00:00
matt 006ba38b09 Fix brain fart. 2011-11-03 18:27:07 +00:00
christos 8801e4b4f0 - make noat-at noreorder-reorder sequences consistent.
- add nop hack to fix assembler internal error.
2011-10-29 20:55:36 +00:00
jakllsch c2f53256f5 Add Broadcom BCM3302 CPU to the table. 2011-10-29 18:56:49 +00:00
jym 325494fe33 Modify *ASSERTMSG() so they are now used as variadic macros. The main goal
is to provide routines that do as KASSERT(9) says: append a message
to the panic format string when the assertion triggers, with optional
arguments.

Fix call sites to reflect the new definition.

Discussed on tech-kern@. See
http://mail-index.netbsd.org/tech-kern/2011/09/07/msg011427.html
2011-09-27 01:02:33 +00:00
macallan e841961c7a the cached/not cached stuff doesn't build when both MIPS1 and MIPS3 are
defined so put it back to #if defined(_MIPS_PADDR_T_64BIT) || defined(_LP64)
there is no good reason why it can't work on MIPS1 though.
2011-09-23 23:02:23 +00:00
macallan a84e510199 make this build again with 32bit paddr_t
from he@
2011-09-23 12:42:15 +00:00
macallan a1ae3c591a remove accidentially committed debug output 2011-09-23 12:34:52 +00:00
macallan 9320bc4780 support BUS_SPACE_MAP_PREFETCH in order to allow mapping device memory and
DMA buffers with cacheing disabled but things like write combining, relaxed
ordering etc. allowed when the CPU supports it
so far enabled only on Loongson, should work on R1xk and probably newer CPUs
2011-09-22 05:08:52 +00:00
macallan f0e7336a90 make the code that deals with mapping regular memory non-cached work again:
- honour PMAP_NOCACHE
- move the PGC_NOCACHE stuff out of #ifdef PARANOIADIAG
we need this to mmap DMA buffers non-cached on sgimips
2011-09-21 16:37:54 +00:00
matt 8f6531abed Use UVM_KMF_COLORMATCH and switch to pmap_kenter_pa for vmapbuf/vunmapbuf. 2011-09-01 06:41:38 +00:00
bouyer b133a35393 There are non-writable bits in MIPS_COP_0_TLB_HI between ASID and VPN, so
mips3_cp0_tlb_entry_hi_probe() returns a value with some 0 in the low 12 bits.
Thus the computed mips_vm_maxuser_address is wrong. Fix by oring PAGE_MASK to
return value of mips3_cp0_tlb_entry_hi_probe().
2011-08-27 16:54:14 +00:00
bouyer 62c4d5a467 Add pmon (firmware used by loongson2-based systems and maybe others) support,
from OpenBSD.
This includes code to call back pmon routines from a 64bit kernel,
as well code to read pmon arguments and variables.
2011-08-27 13:34:29 +00:00
bouyer 4c44c335c5 loongson2f support:
- Add some loongson2 definitions to cpuregs.h, from OpenBSD
- Make sure that the at register is useable before every jump register
  instruction (exept when register is k0 or k1) because -mfix-loongson2f-btb
  needs the at register for its workaround
- add code to mips_fixup.c to handle the instructions added by
  -mfix-loongson2f-btb
- Add a ls2-specific tlb miss handler: it doesn't have separate handler
  for the xtlbmiss exeption.
- Fixes for some #ifdef MIPS3_LOONGSON2 assembly code (using the wrong
  register)
2011-08-27 13:23:52 +00:00
bouyer ad05e3fb85 Loongson2f support:
- make the 'struct bonito_config' const, so that it can be in kernel
  text instead of data.
- Add a bc_attach_hook to struct bonito_config, to be used as pc_attach_hook
  if not NULL.
- Add some LS2-specific register defines (LS2f uses a modified bonito64).
2011-08-27 12:59:16 +00:00
dyoung bf9e39452b Use humanize_number() instead of the buggy code that GCC 4.5 caught.
Compiles.  Not tested.
2011-08-25 02:36:03 +00:00
matt b6945981e5 When using 16KB pages in a 64 bit kernel, the amount of address space our page
table can address can be larger than the amount of address space the CPU
implementation supports.  This change limits the amount address space to what
the CPU implementation provides.
2011-08-24 16:01:53 +00:00
matt e4980d209b On N32 kernels, cast offset to (intptr_t) to shrink it back to 32-bits. 2011-08-24 15:11:52 +00:00
oki a69c375f9d make compile with options RT3050. 2011-08-23 08:10:08 +00:00
matt 42dd23afed Change bcond/BCOND to regimm/REGIMM to better match the MIPS nomenclature. 2011-08-18 21:04:23 +00:00
matt f82a28e694 Redo mips_fixup so that it can handle indirect loads and deal with loongson2
extra instructions.
2011-08-17 14:39:59 +00:00
matt 47d9241c1a emulate the special3 opcode LX (lwx, ldx, lhx, lbux) instructions. 2011-08-17 06:59:28 +00:00
matt f35867174b Add support for the MIPS DSP ASE (as a second PCU). 2011-08-16 06:58:15 +00:00
matt 6c946bd00a Only jump through t9/ra (or k0) to help avoid hitting
the Loongson2 jump problem.
2011-08-16 06:55:11 +00:00
matt 22c9b287d1 Deal with RTMEMSIZE no longer being defined 2011-08-03 17:34:27 +00:00
matt e99aca1b8b Add some defintions for SYSCTL_CFG0 2011-08-03 16:27:15 +00:00
matt df230b318d Deal with RA_CONSOLE_EARLY a little more sanely 2011-08-03 16:26:53 +00:00
matt cd13c53f92 Clear the BTB on user->kernel entry on Loongson2 2011-08-02 05:13:21 +00:00