Commit Graph

559 Commits

Author SHA1 Message Date
bouyer
d3ccea851c Apply patch proposed in PR port-xen/45975 (this does not solve the exact
problem reported here but is part of the solution):
xen_kpm_sync() is not working as expected,
leading to races between CPUs.
1 the check (xpq_cpu != &x86_curcpu) is always false because we
  have different x86_curcpu symbols with different addresses in the kernel.
  Fortunably, all addresses dissaemble to the same code.
  Because of this we always use the code intended for bootstrap, which doesn't
  use cross-calls or lock.

2 once 1 above is fixed, xen_kpm_sync() will use xcalls to sync other CPUs,
  which cause it to sleep and pmap.c doesn't like that. It triggers this
  KASSERT() in pmap_unmap_ptes():
  KASSERT(pmap->pm_ncsw == curlwp->l_ncsw);
3 pmap->pm_cpus is not safe for the purpose of xen_kpm_sync(), which
  needs to know on which CPU a pmap is loaded *now*:
  pmap->pm_cpus is cleared before cpu_load_pmap() is called to switch
  to a new pmap, leaving a window where a pmap is still in a CPU's
  ci_kpm_pdir but not in pm_cpus. As a virtual CPU may be preempted
  by the hypervisor at any time, it can be large enough to let another
  CPU free the PTP and reuse it as a normal page.

To fix 2), avoid cross-calls and IPIs completely, and instead
use a mutex to update all CPU's ci_kpm_pdir from the local CPU.
It's safe because we just need to update the table page, a tlbflush IPI will
happen later. As a side effect, we don't need a different code for bootstrap,
fixing 1). The mutex added to struct cpu needs a small headers reorganisation.

to fix 3), introduce a pm_xen_ptp_cpus which is updated from
cpu_pmap_load(), whith the ci_kpm_mtx mutex held. Checking it with
ci_kpm_mtx held will avoid overwriting the wrong pmap's ci_kpm_pdir.

While there I removed the unused pmap_is_active() function;
and added some more details to DIAGNOSTIC panics.
2012-02-17 18:40:18 +00:00
jym
ab7c6049a8 Xen clock management routines keep track of CPU (following MP merge).
Reflect this change in the suspend/resume routines so they can cope with
domU CPU suspend, instead of setting their cpu_info pointer to NULL.

Avoid copy/pasting by using the resume routines during attachement.

ok releng@.

No regression observed, and allows domU to suspend successfully again.
Restore is a different beast as PD/PT flags are marked "invalid" by Xen-4
hypervisor, and blocks resuming. Looking into it.
2012-02-12 14:38:18 +00:00
cherry
6bed7d4e8c stop using alternate pde mapping in xen pmap 2012-01-28 07:19:17 +00:00
hannken
9a05b44bd8 Revert revision 1.4 and change LAPIC_LEVEL_ASSERT / _MASK back to 0x4000.
According to "Intel 64 and IA-32 Architectures Software Developer's Manual"
Vol. 3, May 2011, Order Number: 325384-039US, Section 10.6.1:

	LEVEL_ASSERT is bit #14, bit #13 is reserved.

With this change NetBSD now boots multiple processors under CentOS 6.2/kvm.
2012-01-20 18:47:04 +00:00
cegger
a3f6c06746 Support CPU microcode loading via cpuctl(8).
Implemented and enabled via CPU_UCODE kernel config option
for x86 and Xen Dom0.
Tested on different AMD machines with different
CPU families.

ok wiz@ for the manpages
ok releng@
ok core@ via releng@
2012-01-13 16:05:14 +00:00
cherry
1f285b3396 Move the per-cpu l3 page allocation code to a separate MD function. Avoids code duplication for xen PAE 2011-12-30 17:57:49 +00:00
abs
90df404d57 Increase MTRR_I686_NVAR_MAX from 8 to 16. Avoids
"FIXME: more than 8 MTRRs (10)" message on booting Thinkpad W520 and
similar. While here replace a magic number with MTRR_I686_NVAR_MAX * 2
2011-12-15 09:38:21 +00:00
cegger
9a48fe3fb2 add AMD ucode MSRs 2011-12-09 10:08:47 +00:00
cegger
908dafc263 switch from xen3-public to xen-public. 2011-12-07 15:47:41 +00:00
chs
b364697460 add info on L2 TLBs and 1GB pages. 2011-12-04 17:00:10 +00:00
chs
2f7da0b2e9 map all of physical memory using large pages.
ported from openbsd years ago by Murray Armfield,
updated for changes since then by me.
2011-12-04 16:24:13 +00:00
tls
a031ce7187 Add support for passing saved entropy (random seed file) to the kernel
from the bootloader.  This can fix the problem of poor quality keys
for other kernel modules which call arc4random() early in kernel startup
(NFS startup, in particular, causes this).

We continue to rely on the etc/rc.d/random_seed script to save entropy
to the seed file at shutdown and erase the seed file at startup.

Boot loader support implemented only for i386 and amd64 ports for now but
it should be easy for other ports to do the same or similar.
2011-11-28 07:56:53 +00:00
jym
95925fc068 No more users of xpmap_update(). Use pmap_pte_*() functions now. 2011-11-23 01:16:55 +00:00
jym
1eaed4e6e6 Move Xen-specific functions to Xen pmap. Requested by cherry@.
Un'ifdef XEN in xen_pmap.c, it is always defined there.
2011-11-23 00:56:56 +00:00
jym
6bfeabc65a Expose pmap_pdp_cache publicly to x86/xen pmap. Provide suspend/resume
callbacks for Xen pmap.

Turn static internal callbacks of pmap_pdp_cache.

XXX the implementation of pool_cache_invalidate(9) is still wrong, and
IMHO this needs fixing before -6. See
http://mail-index.netbsd.org/tech-kern/2011/11/18/msg011924.html
2011-11-20 19:41:27 +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
cherry
de4e5fae37 [merging from cherry-xenmp] bring in bouyer@'s changes via:
http://mail-index.netbsd.org/source-changes/2011/10/22/msg028271.html
From the Log:
Log Message:
Various interrupt fixes, mainly:
keep a per-cpu mask of enabled events, and use it to get pending events.
A cpu-specific event (all of them at this time) should not be ever masked
by another CPU, because it may prevent the target CPU from seeing it
(the clock events all fires at once for example).
2011-11-19 17:13:39 +00:00
jym
56027687e2 Turn the 'i386_use_pae' variable into simply 'use_pae'. Technically
speaking we are also running with PAE enabled in long mode under amd64,
so this variable will be used in various places across x86 machdep to
branch at runtime to functions that require extra handling for PAE mode.
2011-11-10 00:12:04 +00:00
cherry
3520926365 Expose the PG_k #define pt/pd bit to both xen and "baremetal" x86. This is required, since kernel pages are mapped with user permissions in XEN/amd64 since the VM kernel runs in ring3. Since XEN/i386(including PAE) runs in ring1, supervisor mode is appropriate for these ports. We need to share this since the pmap implementation is still shared. Once the xen implementation is sufficiently independant of the x86 one, this can be made private to xen/include/xenpmap.h 2011-11-08 17:16:52 +00:00
cherry
c9745c1f66 [merging from cherry-xenmp] make pmap_kernel() shadow PMD per-cpu and MP aware. 2011-11-06 15:18:18 +00:00
cherry
396b8b4abf [merging from cherry-xenmp] Make the xen MMU op queue locking api private. Implement per-cpu queues. 2011-11-06 11:40:46 +00:00
joerg
22c0e67d0f Reduce exposure of kernel internals for __KMEMUSER 2011-11-01 21:21:32 +00:00
dyoung
848492afca Define some optional routines that will help device_register() to
register ISA & PCI devices.  Add stub implementations of the routines.
2011-10-18 23:25:20 +00:00
jym
0d68d0e3ba Make "pmaps" (list of non-kernel pmaps) and "pmaps_lock" externally
visible. Required by pmap MD code that could reside in other
files, notably Xen's pmap.
2011-10-18 23:14:28 +00:00
jmcneill
3645bf80e9 add a "vm" device class for cpufeaturebus 2011-10-17 22:38:01 +00:00
njoly
17c958e90f Do not redefine CPUID_LAHF. 2011-10-03 17:31:35 +00:00
jym
25f08e65cb Import rdmsr_safe(msr, *value) for x86 world. It allows reading MSRs
in a safe way by handling the fault that might trigger for certain
register <> CPU/arch combos.

Requested by Jukka. Patch adapted from one found in DragonflyBSD.
2011-09-24 10:32:52 +00:00
jym
eba16022d3 Merge jym-xensuspend branch in -current. ok bouyer@.
Goal: save/restore support in NetBSD domUs, for i386, i386 PAE and amd64.

Executive summary:
- split all Xen drivers (xenbus(4), grant tables, xbd(4), xennet(4))
in two parts: suspend and resume, and hook them to pmf(9).
- modify pmap so that Xen hypervisor does not cry out loud in case
it finds "unexpected" recursive memory mappings
- provide a sysctl(7), machdep.xen.suspend, to command suspend from
userland via powerd(8). Note: a suspend can only be handled correctly
when dom0 requested it, so provide a mechanism that will prevent
kernel to blindly validate user's commands

The code is still in experimental state, use at your own risk: restore
can corrupt backend communications rings; this can completely thrash
dom0 as it will loop at a high interrupt level trying to honor
all domU requests.

XXX PAE suspend does not work in amd64 currently, due to (yet again!)
page validation issues with hypervisor. Will fix.

XXX secondary CPUs are not suspended, I will write the handlers
in sync with cherry's Xen MP work.

Tested under i386 and amd64, bear in mind ring corruption though.

No build break expected, GENERICs and XEN* kernels should be fine.
./build.sh distribution still running. In any case: sorry if it does
break for you, contact me directly for reports.
2011-09-20 00:12:23 +00:00
christos
05ec717ee7 Add bus_dma overrides. From dyoung 2011-09-01 15:10:31 +00:00
dyoung
4f4f4d2e20 Add override members to x86_bus_dma_tag. 2011-08-31 20:21:06 +00:00
dyoung
6332563764 Add some code for grovelling in the PCI configuration space for all
of the memory & I/O space reserved by the PCI BIOS for PCI devices
(including bridges) and recording that information for later use.

The code takes between 13k and 50k (depends on the architecture and,
bizarrely, the kernel configuration) so I am going to move it from
pci_machdep.c into its own module on Monday.
2011-08-28 06:04:17 +00:00
dyoung
73b6a5effa Add to x86 bus_space_tag_t a member, bst_exists, that tells whether a
routine is overridden by this tag or by any ancestral tag.
2011-08-25 15:06:10 +00:00
dyoung
6b47091b3b Add definitions from [1] for the I/O APIC's MSI Message Address & Data
registers.

[1] Intel Corporation, Intel 64 and IA-32 Architectures Software
    Developer's Manual, Volume 3A: System Programming Guide, Part 1,
    http://www.intel.com/Assets/PDF/manual/253668.pdf, Chapter 10,
    January, 2011.
2011-08-17 14:55:11 +00:00
cherry
7bd1f7e3fe MP probing and startup code 2011-08-13 12:37:30 +00:00
cherry
92ccc4ea78 Add locking around ops to the hypervisor MMU "queue". 2011-08-13 12:09:38 +00:00
cherry
3c3a6a3a8e Hide the MD details of specific IPIs behind semantically pleasing functions. This cleans up a couple of #ifdef XEN/#endif pairs 2011-08-11 18:11:17 +00:00
cherry
e0e9175da4 Add Xen specific members to struct cpu_info, Add proper per-cpu curcpu() functionality 2011-08-10 06:40:35 +00:00
drochner
f54d17f2c0 add an experimental implementation of PCI MSIs (Message Signaled
Interrupts). Successfully tested with hdaudio and "wpi" wireless
ethernet.
notes:
-There seem to be buggy chips around which announce MSI support
 but don't correctly implement it. Thus the final word whether MSIs
 can be used should be by the driver.
-Only a single vector is supported. For multiple vectors, the IDT
 allocation code would have to be changed. (And we would possibly
 run into problems due to the limited number of vectors supported
 by the current code.)
-The code is "#if NIOAPIC > 0" because it uses the ioapic_edge
 interrupt stubs. These actually don't touch any ioapic, so this
 is somewhat a misnomer.
-MSIs can't be identified by a "pin" but only by a cpu/vector
 pair. Common intr code soesn't deal well with this yet.
-Drivers need to take care of saving/restoring MSI data in the device's
 config space on suspend/resume.
2011-08-01 11:08:03 +00:00
drochner
0ce8c54d89 if checking whether an interrupt is shared, don't compare pin numbers
if it is "-1" -- this is a hack to allow MSIs which don't have a concept
of pin numbers, and are generally not shared
(This doesn't give us sensible event names for statistics display. The
whole abstraction has more exceptions than regular cases, it should
be redesigned imho.)
2011-08-01 10:42:23 +00:00
yamt
44feae8dc4 - add PCID
- comment
2011-07-26 12:59:41 +00:00
dyoung
f9a358cfdb Good-bye bus.h. Don't install <machine/bus.h>. 2011-07-17 23:38:32 +00:00
dyoung
391925c74f #include <sys/bus.h> instead of <machine/bus.h>. 2011-07-01 18:21:31 +00:00
dyoung
59adf08e17 Per discussion at
<http://mail-index.netbsd.org/tech-kern/2010/04/02/msg007941.html>,
divide each machine's bus.h into bus_defs.h (constants & data types)
and bus_funcs.h (macro implementations of bus_space(9) routines and MD
prototypes).

Note that some bus_space(9) routines' implementation will move to .c
files from inline subroutines or macros in .h files.

I've only made the split for machine architectures where there is PCI.
All of the non-PCI-having architectures will require a similar split.

These #include files are not referenced by any (committed) Makefiles or
header files, yet.  Changes to Makefiles, to <sys/bus.h>, and to some
more machine-dependent files will dribble in before I throw the switch.
2011-07-01 17:09:58 +00:00
tls
ceba797a83 Fix Xen kernel builds (pmap_is_curpmap can't be static) 2011-06-13 04:30:40 +00:00
jruoho
2ef5adcc96 Follow IA-64 with the x86-specific ACPI MD functions and move these where
they belong to. Remove an unused function. Minor KNF. No functional change.
2011-06-12 11:31:30 +00:00
jruoho
0fc4e4ab7e Move the evaluation of the _PDC control method out from the acpicpu(4)
driver to the main acpi(4) stack. Follow Linux and evaluate it early.
Should fix PR port-amd64/42895, possibly also PR kern/42583, and many
other comparable bugs.

A common sense explanation is that Intel supplies additional CPU tables to
OEMs. BIOS writers do not bother to modify their DSDTs, but instead load
these extra tables dynamically as secondary SSDT tables. The actual Load()
happens when the _PDC method is invoked, and thus namespace errors occur
when the CPU-specific ACPI methods are not yet present but referenced in the
AML by various drivers, including, but not limited to, acpitz(4).
2011-06-12 10:11:52 +00:00
rmind
e225b7bd09 Welcome to 5.99.53! Merge rmind-uvmplock branch:
- Reorganize locking in UVM and provide extra serialisation for pmap(9).
  New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
  the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
  Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
  kernel-lock on some ports).  Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.
2011-06-12 03:35:36 +00:00
dyoung
0840f9ccfc Don't use the C preprocessor to configure USERCONF. Instead, either do
or do not link in subr_userconf.c and x86_userconf.c.

Provide no-op stubs for userconf_bootinfo(), userconf_init(), and
userconf_prompt().

Delete all occurrences of #include "opt_userconf.h" as well as USERCONF
and __HAVE_USERCONF_BOOTINFO #ifdef'age.
2011-05-31 23:28:52 +00:00
uebayasi
dcf649145a Support userconf(4) command in boot(8)/boot.cfg(5) on i386/amd64.
From jmmv@, no objections seen in the proposed thread:

	http://mail-index.netbsd.org/tech-kern/2009/01/22/msg004081.html
2011-05-26 04:25:26 +00:00
christos
83b36637a6 remove _ 2011-05-22 16:01:43 +00:00
drochner
d999ae2d7d remove stale declarations / empty function 2011-05-18 12:53:04 +00:00
jym
f0672645f9 Do as the comment says, use ilog2(). This gets optimized directly at
compile time, no call to fls() is needed.
2011-05-07 23:59:13 +00:00
christos
6604c82010 add a define for pcb_sp 2011-04-30 16:58:35 +00:00
yamt
aba9023af0 comment 2011-04-25 22:24:36 +00:00
yamt
792bcb515e remove unused ptei 2011-04-25 22:24:00 +00:00
mrg
a8fdd2914b move the include sys/types.h xor stdbool.h to the top of the file,
so that "bool" will be present when used later in the file.
2011-04-13 06:29:30 +00:00
christos
7e80a5d1f8 something ate my / 2011-04-10 20:38:37 +00:00
christos
a640264e31 Merge db_trace for x86. From: Vladimir Kirillov proger at wilab dot org dot ua 2011-04-10 20:36:48 +00:00
dyoung
d3e53912d2 Neither pci_dma64_available(), pci_probe_device(), pci_mapreg_map(9),
pci_find_rom(), pci_intr_map(9), pci_enumerate_bus(), nor the match
predicate passed to pciide_compat_intr_establish() should ever modify
their pci_attach_args argument, so make their pci_attach_args arguments
const and deal with the fallout throughout the kernel.

For the most part, these changes add a 'const' where there was no
'const' before, however, some drivers and MD code used to modify
pci_attach_args.  Now those drivers either copy their pci_attach_args
and modify the copy, or refrain from modifying pci_attach_args:

Xen: according to Manuel Bouyer, writing to pci_attach_args in
    pci_intr_map() was a leftover from Xen 2.  Probably a bug.  I
    stopped writing it.  I have not tested this change.

siside(4): sis_hostbr_match() needlessly wrote to pci_attach_args.
    Probably a bug.  I use a temporary variable.  I have not tested this
    change.

slide(4): sl82c105_chip_map() overwrote the caller's pci_attach_args.
    Probably a bug.  Use a local pci_attach_args.  I have not tested
    this change.

viaide(4): via_sata_chip_map() and via_sata_chip_map_new() overwrote the
    caller's pci_attach_args.  Probably a bug.  Make a local copy of the
    caller's pci_attach_args and modify the copy.  I have not tested
    this change.

While I'm here, make pci_mapreg_submap() static.

With these changes in place, I have tested the compilation of these
kernels:

alpha GENERIC
amd64 GENERIC XEN3_DOM0
arc GENERIC
atari HADES MILAN-PCIIDE
bebox GENERIC
cats GENERIC
cobalt GENERIC
evbarm-eb NSLU2
evbarm-el ADI_BRH ARMADILLO9 CP3100 GEMINI GEMINI_MASTER GEMINI_SLAVE GUMSTIX
	HDL_G IMX31LITE INTEGRATOR IQ31244 IQ80310 IQ80321 IXDP425 IXM1200
	KUROBOX_PRO LUBBOCK MARVELL_NAS NAPPI SHEEVAPLUG SMDK2800 TEAMASA_NPWR
	TEAMASA_NPWR_FC TS7200 TWINTAIL ZAO425
evbmips-el AP30 DBAU1500 DBAU1550 MALTA MERAKI MTX-1 OMSAL400 RB153 WGT624V3
evbmips64-el XLSATX
evbppc EV64260 MPC8536DS MPC8548CDS OPENBLOCKS200 OPENBLOCKS266
	OPENBLOCKS266_OPT P2020RDB PMPPC RB800 WALNUT
hp700 GENERIC
i386 ALL XEN3_DOM0 XEN3_DOMU
ibmnws GENERIC
macppc GENERIC
mvmeppc GENERIC
netwinder GENERIC
ofppc GENERIC
prep GENERIC
sandpoint GENERIC
sgimips GENERIC32_IP2x
sparc GENERIC_SUN4U KRUPS
sparc64 GENERIC

As of Sun Apr 3 15:26:26 CDT 2011, I could not compile these kernels
with or without my patches in place:

### evbmips-el GDIUM

nbmake: nbmake: don't know how to make /home/dyoung/pristine-nbsd/src/sys/arch/mips/mips/softintr.c. Stop

### evbarm-el MPCSA_GENERIC
src/sys/arch/evbarm/conf/MPCSA_GENERIC:318: ds1672rtc*: unknown device `ds1672rtc'

### ia64 GENERIC

/tmp/genassym.28085/assym.c: In function 'f111':
/tmp/genassym.28085/assym.c:67: error: invalid application of 'sizeof' to incomplete type 'struct pcb'
/tmp/genassym.28085/assym.c:76: error: dereferencing pointer to incomplete type

### sgimips GENERIC32_IP3x

crmfb.o: In function `crmfb_attach':
crmfb.c:(.text+0x2304): undefined reference to `ddc_read_edid'
crmfb.c:(.text+0x2304): relocation truncated to fit: R_MIPS_26 against `ddc_read_edid'
crmfb.c:(.text+0x234c): undefined reference to `edid_parse'
crmfb.c:(.text+0x234c): relocation truncated to fit: R_MIPS_26 against `edid_parse'
crmfb.c:(.text+0x2354): undefined reference to `edid_print'
crmfb.c:(.text+0x2354): relocation truncated to fit: R_MIPS_26 against `edid_print'
2011-04-04 20:37:49 +00:00
dyoung
7b673ebd9e Clean up excessive #ifdef'age of NMI trap handling for amd64/i386/xen.
Handle NMI in all Xen kernels.
2011-04-03 22:29:25 +00:00
christos
254ee22cb1 add fp{g,s}etprec 2011-03-26 19:52:20 +00:00
jruoho
839fb5fa76 Move INTEL_ONDEMAND_CLOCKMOD -- or odcm(4) -- to the cpufeaturebus. 2011-03-04 04:48:39 +00:00
jruoho
c56d0a6b9b Fix autoconf(9) of cpufeaturebus. 2011-02-24 15:42:17 +00:00
jruoho
ad932f2c35 Move PowerNow! to the cpufeaturebus. 2011-02-24 10:56:00 +00:00
jruoho
acdf26369f Move ENHANCED_SPEEDSTEP, or henceforth est(4), to the cpufeaturebus. 2011-02-23 11:43:21 +00:00
jruoho
7bbe979aae Add MSR_TEMPERATURE_TARGET. 2011-02-20 21:09:32 +00:00
jruoho
8cbd1d28ca Modularize coretemp(4). Ok jmcneill@. 2011-02-20 13:42:45 +00:00
jmcneill
48d1e7b781 cpu.h no longer needs via_padlock.h 2011-02-20 12:47:21 +00:00
jmcneill
d86215c443 modularize VIA PadLock support
- retire options VIA_PADLOCK, replace with 'padlock0 at cpu0'
 - driver supports attach & detach
 - support building as a module
2011-02-19 13:52:27 +00:00
cegger
db0e6900db update cpuid bits 2011-02-15 10:11:25 +00:00
jmcneill
26d15d7df2 add bus_space_mmap support for BUS_SPACE_MAP_PREFETCHABLE, ok matt@ 2011-02-11 23:08:38 +00:00
jmcneill
960f1e30de if genfb is attached, hook into db_trap_callback to switch in and out of
polling mode as necessary
2011-02-09 13:24:23 +00:00
ahoka
4a22e1afa7 Add missing prototype for x86_genfb_mtrr_init to fix build.
Hi Jared!
2011-02-08 20:55:51 +00:00
jmcneill
4f25757c6e add BI_MODULE_IMAGE boot module type 2011-02-06 23:14:04 +00:00
bouyer
b7050e7fd4 Some CPU have cpu counter (CPUID_TSC is there) but don't handle the
rdmsr instruction (CPUID_MSR is not there).
Introduce a cpu_counter_serializing() function to remplace rdmsr(MSR_TSC)
calls, which does a rdmsr(MSR_TSC) if available and cpu_counter() otherwise.
This makes the cpu counter useable on vortex86 CPUs.
OK ad@
2011-02-02 12:26:42 +00:00
chuck
39094c9da3 udpate license clauses on my code to match the new-style BSD licenses.
remove no-longer-valid wustl email address for me.
based on diff that rmind@ sent me.

no functional change with this commit.
2011-02-01 20:19:31 +00:00
bouyer
e8e2c45302 Properly identify vortex86 CPUs. 2011-01-27 18:44:40 +00:00
jruoho
99d6864d21 Move the function that counts the CPUs from acpicpu(4) to the MD layer. 2011-01-13 03:40:50 +00:00
christos
1101fc9115 Make __HAVE_CPU_DATA_FIRST true 2010-12-22 04:15:01 +00:00
christos
61081d3e2f To use x86/cpu.h struct cpu_info from userland, we need via_padlock.h installed. 2010-12-20 04:29:29 +00:00
cegger
37c06c3a7b add interrupt EAPIC register definitions 2010-11-15 11:58:09 +00:00
uebayasi
63631ac178 Pull in uvm/uvm.h for VM_PAGE_TO_PHYS(). 2010-11-12 13:35:51 +00:00
jakllsch
97391e280b Unbreak Xen build, while not actually fixing the real problem.
NetBSD/xen doesn't implement disestablishing interrupts yet.
2010-11-06 04:14:30 +00:00
jakllsch
b6de3f4dc9 Implement pciide_machdep_compat_intr_disestablish() to help enable
detachment of compatibility-mapped pciide(4)-family controllers.
2010-11-06 00:35:44 +00:00
jruoho
dfc6c7a7ff Remove some unused (ACPI) constants. 2010-10-26 07:54:12 +00:00
yamt
9dbb22af20 don't forget to call nmi_init. 2010-10-21 11:17:54 +00:00
jakllsch
2571582bb0 Correct another off-by-one-bit error. This time for Erratum 97. 2010-10-12 00:39:08 +00:00
jakllsch
3f28b50a70 AMD publication 25759 rev 3.69 says that DisIOReqLock in NB_CFG is "bit 3".
They probably mean "bit 3" and not "the third bit" (or bit 2).
This change should prevent superfluous warnings of errata 89.
2010-09-18 15:49:25 +00:00
christos
e2a86dd3c7 Commit SoC long double support from Stathis Kamperis 2010-09-15 16:11:28 +00:00
jruoho
cff1577a2c Add definitions for Intel Digital Thermal Sensor and Power Management, at
CPUID Fn0000_0006, %eax, %ecx. Use these instead of magic numbers.
2010-08-25 05:07:43 +00:00
jruoho
4f4a7a5d46 Other entry points beyond x86_cpu_idle_halt() may use HLT as the
idle-mechanism. Send an IPI also for these in cpu_need_resched().
2010-08-23 16:20:44 +00:00
jruoho
ec113abb1c Add IA32_MPERF (E7h) and IA32_APERF (E8h) as MSR_MPERF and MSR_APERF. 2010-08-21 02:59:18 +00:00
jruoho
78ed01b2e1 Add CPUID_APM_CPB at Fn8000_0007 %edx, for core performance boost. 2010-08-21 02:31:13 +00:00
jruoho
a448b8a1b9 Revert all previous changes that were made naively believing that the
existing CPU power management implementations could peacefully coexist with
the acpicpu(4) driver. The following options can not be used with acpicpu(4):
ENHANCED_SPEEDSTEP, INTEL_ONDEMAND_CLOCKMOD, POWERNOW_K7, and POWERNOW_K8.
2010-08-20 06:34:32 +00:00
jruoho
e1be1909e4 Add sysctl-glue for interaction with the acpicpu(4). 2010-08-19 04:12:45 +00:00
jym
df8a7061db Add machdep.pae sysctl(7) for i386. Thanks to Paul and Joerg for their
reviews.

In kernel, it matches the 'i386_use_pae' variable (0: kernel does not use
PAE, 1: kernel uses PAE). Will be used by i386 kvm(3) to know the functions
that should get called for VA => PA translations.
2010-08-16 19:39:06 +00:00
jruoho
3d0f130a61 Revert the previous changes to EST. The used hack had an obvious flaw:
the acpicpu(4) driver should attach even if the existing frequency management
code fails to attach, mainly because ACPI is the only proper way to deal
with EST on new Intel system.

Use a more drastic hack to deal with this: when acpicpu(4) attachs, it tears
down any existing sysctl(8) controls and installs identical ones in place.
Upon detachment, the initialization function of the existing EST is called.
2010-08-09 15:46:17 +00:00
jruoho
cf677a3b1e Move the sysctl function pointers used by acpicpu(4) to x86/cpu.c.
Rename these so that the same pointers may be used in other parts.
2010-08-09 04:18:48 +00:00
jruoho
53e8f6c919 Merge P-state support for acpicpu(4).
Remarks:

  1.    All processors (x86 or not) for which the vendor has implemented
        ACPI I/O access routines are supported. Native instructions are
        currently supported only for Intel's "Enhanced Speedstep". Code for
        "PowerNow!" (AMD) will be merged later. Native support for VIA's
        "PowerSaver" will be investigated.

  2.    Backwards compatibility with existing userland code is maintained.
        Comparable to the case with cpu_idle(9), the ACPI CPU driver
        installs alternative functions for the existing sysctl(8) controls.
        The "native" behavior (if any) is restored upon detachment.

  3.    The dynamic nature of ACPI-provided P-states needs more investigation.
        The maximum frequency induced (but not forced) by the firmware may
        change dynamically. Currently, the sysctl(8) controls error out with
        a value larger than the dynamic maximum. The code itself does not
        however yet react to the notifications from the firmware by changing
        the frequencies in-place. Presumably the system administrator should
        be able to choose whether to use dynamic or static frequencies.
2010-08-08 16:58:41 +00:00
jruoho
d8b9e18823 Store the MADT-derived CPU ID to <x86/cpu.h>. This is required to properly
match the ACPI processor object ID with the ID available in the APIC table.
2010-08-04 10:02:11 +00:00
mlelstv
e5aae12639 sc_cmd_mtx protects a command sequence, no longer abuse it for delays.
Initialize mutexes and condition variables in attach and not in the
asynchronously started kernel thread.

Increase BMC spin timeout from 5ms to 15ms, this is necessary to detect
the BMC in a HP ML110G4 reliably.

Implement non-linear sensors as defined in IPMIv2.0 with some crude
32.32 fixed point arithmetic. This adds some small errors as logarithm
and power functions are only approximated.

Fix sensor index mapping so that sensor limits are computed correctly.
2010-08-01 08:16:14 +00:00
joerg
7f1183f226 Add support for fenv.h interface for i386 and amd64.
Submitted by Stathis Kamperis as part of GSoC 2010 and ported from
FreeBSD.
2010-07-31 21:47:52 +00:00
cegger
6e8417c157 add RDTSCP_AUX MSR 2010-07-29 08:16:49 +00:00
jruoho
f534f13d87 Revert the previous partially for the time being. 2010-07-24 21:53:53 +00:00
jruoho
6f76995c42 Move ACPI_FLUSH_CPU_CACHE() (a.k.a. WBINVD on x86) to MD headers where it
belongs to. Let IA-64 define its own function/instruction instead of
requiring a dummy wbinvd() to satisfy the definition in a MI header.
2010-07-24 09:35:36 +00:00
cegger
17310da7fe add AMD OSVW MSRs 2010-07-24 08:02:46 +00:00
jym
d94742232d Welcome PAE inside i386 current.
This patch is inspired by work previously done by Jeremy Morse, ported by me
to -current, merged with the work previously done for port-xen, together with
additionals fixes and improvements.

PAE option is disabled by default in GENERIC (but will be enabled in ALL in
the next few days).

In quick, PAE switches the CPU to a mode where physical addresses become
36 bits (64 GiB). Virtual address space remains at 32 bits (4 GiB). To cope
with the increased size of the physical address, they are manipulated as
64 bits variables by kernel and MMU.

When supported by the CPU, it also allows the use of the NX/XD bit that
provides no-execution right enforcement on a per physical page basis.

Notes:

- reworked locore.S

- introduce cpu_load_pmap(), used to switch pmap for the curcpu. Due to the
different handling of pmap mappings with PAE vs !PAE, Xen vs native, details
are hidden within this function. This helps calling it from assembly,
as some features, like BIOS calls, switch to pmap_kernel before mapping
trampoline code in low memory.

- some changes in bioscall and kvm86_call, to reflect the above.

- the L3 is "pinned" per-CPU, and is only manipulated by a
reduced set of functions within pmap. To track the L3, I added two
elements to struct cpu_info, namely ci_l3_pdirpa (PA of the L3), and
ci_l3_pdir (the L3 VA). Rest of the code considers that it runs "just
like" a normal i386, except that the L2 is 4 pages long (PTP_LEVELS is
still 2).

- similar to the ci_pae_l3_pdir{,pa} variables, amd64's xen_current_user_pgd
becomes an element of cpu_info (slowly paving the way for MP world).

- bootinfo_source struct declaration is modified, to cope with paddr_t size
change with PAE (it is not correct to assume that bs_addr is a paddr_t when
compiled with PAE - it should remain 32 bits). bs_addrs is now a
void * array (in bootloader's code under i386/stand/, the bs_addrs
is a physaddr_t, which is an unsigned long).

- fixes in multiboot code (same reason as bootinfo): paddr_t size
change. I used Elf32_* types, use RELOC() where necessary, and move the
memcpy() functions out of the if/else if (I do not expect sym and str tables
to overlap with ELF).

- 64 bits atomic functions for pmap

- all pmap_pdirpa access are now done through the pmap_pdirpa macro. It
hides the L3/L2 stuff from PAE, as well as the pm_pdirpa change in
struct pmap (it now becomes a PDP_SIZE array, with or without PAE).

- manipulation of recursive mappings ( PDIR_SLOT_{,A}PTEs ) is done via
loops on PDP_SIZE.

See also http://mail-index.netbsd.org/port-i386/2010/07/17/msg002062.html

No objection raised on port-i386@ and port-xen@R for about a week.

XXX kvm(3) will be fixed in another patch to properly handle both PAE and !PAE
kernel dumps (VA => PA macros are slightly different, and need proper 64 bits
PA support in kvm_i386).

XXX Mixing PAE and !PAE modules may lead to unwanted/unexpected results. This
cannot be solved easily, and needs lots of thinking before being declared
safe (paddr_t/bus_addr_t size handling, PD/PT macros abstractions).
2010-07-24 00:45:54 +00:00
jruoho
4d861e5bb4 Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).

Remarks:

  1.	Commented out in the GENERICs; more testing exposure is needed.

  2.	The C3-state is disabled for the time being because it turns off
	timers, among them the local APIC timer. This may not be universally
	true on all x86 processors; define ACPICPU_ENABLE_C3 to test.

  3.	The algorithm used to choose a power state may need tuning. When
	evaluating the appropriate state, the implementation uses the
	previous sleep time as an indicator. Additional hints would include
	for example the system load.

	Also bus master activity is evaluated when choosing a state. The
	usb(4) stack is notorious for such activity even when unused.
	Typically it must be disabled in order to reach the C3-state,
	but it may also prevent the use of C2.

  4.	While no extensive empirical measurements have been carried out, the
	power savings are somewhere between 1-2 W with C1 and C2, depending
	on the processor, firmware, and load. With C3 even up to 4 W can be
	saved.  The less something ticks, the more power is saved.

ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 09:29:11 +00:00
jym
7d13a50ab2 Make the comment about PDPpaddr more thorough. 2010-07-15 19:02:26 +00:00
chs
ffa744f452 add the guts of TLS support on amd64. based on joerg's patch,
reworked by me to support 32-bit processes as well.
we now keep %fs and %gs loaded with the user values
while in the kernel, which means we don't need to
reload them when returning to user mode.
2010-07-07 01:14:52 +00:00
njoly
3bb7b36948 Install x86/pte.h 2010-07-07 00:10:14 +00:00
cegger
a63798ea7c Turn PMAP_NOCACHE into MI flag.
Add MI flags PMAP_WRITE_COMBINE, PMAP_WRITE_BACK, PMAP_NOCACHE_OVR.
Update pmap(9) manpage.

hppa: Remove MD PMAP_NOCACHE flag as it exists as MI flag
mips: Rename MD PMAP_NOCACHE to PGC_NOCACHE.

x86: Implement new MI flags using Page-Attribute Tables.
x86: Implement BUS_SPACE_MAP_PREFETCHABLE.

Patch presented on tech-kern@:
http://mail-index.netbsd.org/tech-kern/2010/06/30/msg008458.html

No comments on this last version.
2010-07-06 20:50:33 +00:00
rmind
1840edb963 Implement high priority (XC_HIGHPRI) xcall(9) mechanism - a facility
to execute functions from software interrupt context, at SOFTINT_CLOCK.
Functions must be lightweight.  Will be used for passive serialization.

OK ad@.
2010-06-22 18:29:01 +00:00
dyoung
19265b4bb9 Provide pmap_enter_ma(), pmap_extract_ma(), pmap_kenter_ma() in all x86
kernels, and use them in the bus_space(9) implementation instead of ugly
Xen #ifdef-age.  In a non-Xen kernel, the _ma() functions either call or
alias the equivalent _pa() functions.

Reviewed on port-xen@netbsd.org and port-i386@netbsd.org.  Passes
rmind@'s and bouyer@'s inspection.  Tested on i386 and on Xen DOMU /
DOM0.
2010-05-10 18:46:58 +00:00
rmind
da7cf0ef2f Drop x86 MD package/core/smt IDs and use MI. 2010-05-09 20:32:41 +00:00
jym
d66ce3b289 Enable the NX bit feature for Xen i386pae and amd64 kernels.
Tested with Xen 3.1 and Xen 3.3, dom0 and domU, by bouyer@ and jym@.

Ok bouyer@.
2010-05-04 23:27:13 +00:00
plunky
b8a6a61f01 The spl inline functions refer to external symbols that are only
defined in the kernel.

Wrap kernel-specific declarations in #ifdef _KERNEL to avoid unresolved
references when including from userland.
2010-05-02 18:03:31 +00:00
dyoung
7ce5c4de22 Provide an x86 implementation of pci_chipset_tag_create(9) and
pci_chipset_tag_destroy(9).
2010-04-28 21:27:14 +00:00
dyoung
30b2d68d20 On x86, change the bus_space_tag_t to a pointer to a struct
bus_space_tag.  For now, bus_space_tag's only member is
bst_type, the type of space, which is either X86_BUS_SPACE_IO
or X86_BUS_SPACE_MEM.  In the future, new bus_space_tag members
will refer to override-functions installed by a new function,
bus_space_tag_create(9).

Add pointers to constant struct bus_space_tag, x86_bus_space_io and
x86_bus_space_mem.  Use them to replace most uses of X86_BUS_SPACE_IO
and X86_BUS_SPACE_MEM.

Add an x86-specific bus_space_is_equal(9) implementation that compares
the two tags' bst_type.
2010-04-28 19:17:03 +00:00
ad
b78c6a36cf Nothing uses x86_multicast_ipi() right now and it complicates many
CPU support, so remove it.
2010-04-25 16:10:51 +00:00
jym
bc0420413d This patch fixes the NX regression issue observed on amd64 kernels, where
per-page execution right was disabled (therefore leading to the inability
of the kernel to detect fraudulent use of memory mappings marked as not
being executable).

- replace cpu_feature and ci_feature_flags variables by cpu_feature and
ci_feat_val arrays. This makes it cleaner and brings kernel code closer
to the design of cpuctl(8). A warning will be raised for each CPU that
does not expose the same features as the Boot Processor (BP).

- the blacklist of CPU features is now a macro defined in the
specialreg.h header, instead of hardcoding it inside MD initialization
code; fix comments.

- replace checks against CPUID_TSC with the cpu_hascounter() function.

- clean up the code in init_x86_64(), as cpu_feature variables are set
inside cpu_probe().

- use cpu_init_msrs() for i386. It will be eventually used later for NX
feature under i386 PAE kernels.

- remove code that checks for CPUID_NOX in amd64 mptramp.S, this is already
performed by cpu_hatch() through cpu_init_msrs().

- remove cpu_signature and feature_flags members from struct mpbios_proc
(they were never used).

This patch was tested with i386 MONOLITHIC, XEN3PAE_DOM0 and XEN3_DOM0 under
a native i386 host, and amd64 GENERIC, XEN3_DOM0 via QEMU virtual machines.

XXX Should kernel rev be bumped?

XXX A similar patch should be pulled-up for NetBSD-5, hopefully tomorrow.
2010-04-18 23:47:50 +00:00
jym
c4d1a64e49 Fix the comments about cpuid flags, according cpuid documentation by
Intel and AMD.
2010-04-03 23:17:05 +00:00
dyoung
061b0589a4 Add a prototype for pci_mmio_range_infer() that will infer the
range of memory forwarded by the host chipset to PCI.
2010-03-20 00:02:59 +00:00
dyoung
090e16c442 Add a new member, pc_super, to x86's pci_chipset_tag: pc.pc_super points
to the tag that pc inherits its behavior from.  Add code to deal with
pc.pc_super.

Pull identical declarations out of xen/include/pci_machdep.h and
x86/include/pci_machdep.h into x86/include/pci_machdep_common.h.
2010-03-14 20:19:06 +00:00
dyoung
6bbebe48f4 Change the pci_attach_args definition to allow machine-dependent
code to override the default pci(9) behavior by creating a non-NULL
pci_attach_args_t (on x86, pci_attach_args_t is always NULL) containing
one or more non-NULL function pointers.
2010-02-25 20:48:34 +00:00
dyoung
7e2170d1cd KNF: change spaces to tabs. 2010-02-24 21:34:23 +00:00
dyoung
71e3c83259 Don't bother to #define PCI_PREFER_IOSPACE, nothing uses it. 2010-02-24 21:25:51 +00:00
dyoung
440f38e104 Change 'typedef void *pci_chipset_tag_t' to 'typedef struct
pci_chipset_tag *pci_chipset_tag_t' for an improvement in type safety.
(Back when I did the same for cardbus_chipset_tag_t, it helped to turn
up some bugs!)
2010-02-24 21:24:20 +00:00
dyoung
07a5af08b1 Get rid of all PCI_CONF_MODE #ifdef'age except for the little bit
that initializes pci_mode, which I have moved to the top.

Make pci_mode private to pci_machdep.c.

Provide pci_mode_set() for pcibios.c to configure the PCI Configuration
Mechanism.  KASSERT() in pci_mode_set() that the mechanism is not
changing from anything but the "don't know" value, -1.
2010-02-16 00:03:47 +00:00
jym
753d396585 Fix typos in comments. 2010-02-09 22:51:13 +00:00
rmind
b6c2588582 x86_cpu_topology, not toplogy. 2010-01-18 16:40:17 +00:00
cegger
abd4f4b435 recognize SVM PauseFilter 2010-01-13 12:54:49 +00:00
cegger
06f2c03231 add x2apic support.
patch presented on current-users@, port-i386@ and port-amd64@ on 2009-12-22

No comments.
2010-01-09 20:56:17 +00:00
cegger
07e7c0c3fa add LAPIC_MSR_ENABLE_x2 MSR. from murray@river-styx via port-amd64@
'...as documented in the Intel 64 and IA32 Architectures Software
   Developers Manual 3A, chapter 10.5.1.'
2010-01-09 20:50:11 +00:00
rmind
3c2bd91e81 Use lwp_getpcb() on x86 MD code, clean from struct user usage. 2009-11-21 03:11:00 +00:00
cegger
e72026cf1f update comment: we use PMAP_NOCACHE for both pmap_enter and pmap_kenter_pa 2009-11-11 17:08:16 +00:00
cegger
9480c51b04 Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.
2009-11-07 07:27:40 +00:00
rmind
b619d660f4 Remove X86_IPI_WRITE_MSR (and msr_ipifuncs.c), replace all uses in drivers
with xc_broadcast().  AMD K8 PowerNow driver tested by <jakllsch>, thanks!

Closes PR/37665.
2009-10-05 23:59:30 +00:00
jmcneill
574c128daa Add support for VIA C7 temperature sensors (options VIA_C7TEMP) 2009-10-02 18:50:03 +00:00
jmcneill
f986f9682c Use the TSC and current multiplier to calculate bus clock on VIA C7 Esther.
Probably needed for all C7 and Nano processors, but to be safe only use
this alternate method on Esther for now.

Now est on my C7-M 1.6GHz properly reports frequencies from 1600 to 400,
instead of 2133 to 533.
2009-10-02 15:05:42 +00:00
jmcneill
8984ef0dcd Add vga_post_set_vbe for setting video mode. 2009-08-24 11:33:49 +00:00
jmcneill
b585cf85b2 Pass the VBE mode number from the bootloader to the kernel, and then
make the ACPI wakecode aware of it. Restore the desired VBE mode on resume
when acpi_vbios_reset=1, so suspend/resume with genfb console will work.
2009-08-24 02:15:46 +00:00
dyoung
a1ac1a18e2 isa_detach_hook() needs two arguments, the first an isa_chipset_tag_t. 2009-08-19 15:04:27 +00:00
dyoung
47b66b70d9 These are stragglers from my last commit ("Let us safely detach
the ISA bus and devices attaching to the ISA bus").  Define
isa_detach_hook() in MD ISA implementations.  Define isa_dmadestroy().
2009-08-18 17:02:00 +00:00
cegger
46e5d74b06 recognize virtual cpu feature indicating guest state. 2009-08-13 11:27:34 +00:00
jym
bba2c41d59 Add Intel SpeedStep and AMD PowerNow! support in Xen dom0. MSR operations
are now compiled in by default.

Note that MSR support in Xen depends on its version. rdmsr() should always
succeed, but wrmsr() to certain registers can end in a NOOP. In that case,
the error will be logged (see xm dmesg).

Setting CPU frequency (SpeedStep) requires Xen 3.3 with the option
cpufreq="dom0-kernel" passed down to hypervisor during boot.

Compiled and tested for SpeedStep under i386 for XEN3_DOM0 and XEN3PAE_DOM0
by jym@. amd64 was tested by Joel Carnat.

See also http://mail-index.netbsd.org/port-xen/2009/08/02/msg005213.html .

Commit requested by bouyer@.
2009-08-05 20:15:36 +00:00
dyoung
0c985f2dad Overhaul synchronization in ipmi(4): synchronize all access to
device registers with a mutex.  Convert tsleep/wakeup calls to
cv_wait/cv_signal.

Do not repeatedly malloc/free tiny buffers for sending/receiving
commands, but reserve a command buffer in the softc.

Tickle the watchdog in the sensors-refreshing thread.

I am fairly certain that after the device is attached, every register
access happens in the sensors-refreshing thread.  Moreover, no
software interrupt touches any register, now.  So I may get rid of
the mutex that protects register accesses, sc_cmd_mtx.
2009-07-20 19:11:30 +00:00
rmind
1be5c7a891 pmap_emap_sync: add an argument, and do not perform pmap_load() during
context switch (pmap_destroy() path seems to be unsafe), instead just
perform tlbflush().  Slightly inefficient, but good enough for now.
2009-07-19 15:17:29 +00:00
rmind
5c68e5d0ee Ephemeral mapping (emap) implementation. Concept is based on the idea that
activity of other threads will perform the TLB flush for the processes using
emap as a side effect.  To track that, global and per-CPU generation numbers
are used.  This idea was suggested by Andrew Doran; various improvements to
it by me.  Notes:

- For now, zero-copy on pipe is not yet enabled.
- TCP socket code would likely need more work.
- Additional UVM loaning improvements are needed.

Proposed on <tech-kern>, silence there.
Quickly reviewed by <ad>.
2009-06-28 15:18:50 +00:00
bouyer
3ac2dfe9bf Split mc146818-related functions from clock.c into rtc.c.
Call rtc_set_ymdhms() from xen/xen/clock.c:xen_rtc_set() for xen3 dom0
kernels as the Xen3 hypervisor doesn't write the new date/time to the CMOS
by itself.
Now a XEN3_DOM0 kernel properly updates the CMOS time.
2009-06-16 21:05:33 +00:00