Commit Graph

723 Commits

Author SHA1 Message Date
ad
058b47f572 Re-base the cpu types at 0 so they can be used as an array index. 2008-05-11 13:36:33 +00:00
joerg
1ae05b2bbf Don't use the legacy interrupt when deciding how to route IOAPIC pins.
On some modern systems not all devices have the PCI interrupt line
set, typically the cardbus bridge is affected and it would result in
different interrupt vectors used for the same IOAPIC pin.
To allow this, simplify the code by checking for an existing match first
and only allocate a new entry if that doesn't exist. For the IOAPIC case
don't bother with the reserveration on the primary CPU for ISA
interrupts, just use them.
2008-05-11 13:18:25 +00:00
ad
bd06c33f6e Fix a potential hang during skew detection (not observed). 2008-05-11 12:41:13 +00:00
cegger
2a9c1861c0 aprint_normal -> aprint_normal_dev
sizeof line -> sizeof(line)
2008-05-11 09:31:49 +00:00
ad
bd60b91d0a If the boot processor's lapic has the wrong ID, reset it. 2008-05-10 17:23:54 +00:00
ad
47f99407d1 Assume that TSC is stable on P-II and P-III Xeons, since systems with those
CPUs are likely to have a TSC-friendly configuration.
2008-05-10 16:44:00 +00:00
ad
c328252caf TSC should also be enabled for intel f03. 2008-05-10 16:37:08 +00:00
ad
75ada79f33 Improve x86 tsc handling:
- Ditch the cross-CPU calibration stuff. It didn't work properly, and it's
  near impossible to synchronize the CPUs in a running system, because bus
  traffic will interfere with any calibration attempt, messing up the
  timings.

- Only enable the TSC on CPUs where we are sure it does not drift. If we are
  On a known good CPU, give the TSC high timecounter quality, making it the
  default.

- When booting CPUs, detect TSC skew and account for it. Most Intel MP
  systems have synchronized counters, but that need not be true if the
  system has a complicated bus structure. As far as I know, AMD systems
  do not have synchronized TSCs and so we need to handle skew.

- While an AP is waiting to be set running, try and make the TSC drift by
  entering a reduced power state. If we detect drift, ensure that the TSC
  does not get a high timecounter quality. This should not happen and is
  only for safety.

- Make cpu_counter() stuff LKM safe.
2008-05-10 16:12:32 +00:00
ad
9a48c061bc Remove tsc debugging code. 2008-05-10 15:05:01 +00:00
ad
9ab200719c Merge cpu_counter.h. 2008-05-10 14:53:54 +00:00
cegger
d4e5a8360c Buildfix: Remove duplicate #defines. 2008-05-09 21:53:56 +00:00
joerg
f809e517f2 Only check for hlt on !Xen. This needs to be reviewed when Xen gets SMP
support.
2008-05-09 21:25:43 +00:00
ad
8b6686aea4 LAPIC_ID_MASK is 8 bits these days. 2008-05-09 21:23:48 +00:00
joerg
a790b941e6 Make cpu_idle a macro calling a function pointer on x86.
Select the Xen idle routine for Xen, mwait if supported by the CPU and
it is not AMD and halt otherwise. As reported by Christoph Egger,
AMD Barcelona keeps the CPU in C0 state with MWAIT, contrary to HLT,
which uses C1 and therefore much less power.
2008-05-09 18:11:28 +00:00
joerg
1e127b8726 Remove some prototypes that are not implemented. Make some functions
static that are only used in intr.c.
2008-05-07 07:00:16 +00:00
jmcneill
729313d52c Use 2-clause license. 2008-05-05 00:12:49 +00:00
cegger
86bf5bcac7 ansify 2008-05-03 17:03:45 +00:00
ad
2b688dc23b Back out previous which was not thought through properly. 2008-05-03 02:56:13 +00:00
ad
3a991d1e4a Implement pmap_remove_all(). 2008-05-03 00:21:35 +00:00
ad
bfc5732320 - Give x86 BIOS boot the ability to load new style modules and pass them
into the kernel. Based on a patch by jmcneill@, with many fixes and
  improvements by me.

- Put MEMORY_DISK_DYNAMIC and MODULAR into the GENERIC kernels, so that
  you can load miniroot.kmod from the boot blocks and boot into the
  installer!
2008-05-02 15:26:38 +00:00
ad
c379d13c35 Kernel preemption needs to be off for tlb shootdowns. 2008-05-01 12:03:18 +00:00
ad
a7fbd437d1 If MP is disabled at the boot prompt, then don't use MPBIOS. When ACPI
is also disabled, this completely avoids using ioapics.
2008-04-30 23:25:49 +00:00
ad
e1df701f0d Avoid unneeded AST faults. 2008-04-30 12:44:27 +00:00
joerg
48d8e65bbd Exploit ci->ci_isources[slot] == source to simplify code. 2008-04-30 12:00:52 +00:00
cegger
c92d850bb3 AMD's APM Volume 2 says 'All control registers are 64bit in long mode'.
Fix the CR0 prototype to match this (the asm implementation is correct though).
OK ad
2008-04-30 00:16:30 +00:00
ad
5d794f8931 PR kern/38537 __HAVE_PREEMPTION requires MULTIPROCESSOR
Don't patch out the kernel_lock functions if ncpu == 1. We need it for
preemption, and it's used much less frequently than before.
2008-04-30 00:05:20 +00:00
ad
5804d4a96d Minor correction to previous. 2008-04-29 19:19:29 +00:00
ad
9a4949249f Recognise two new boot flags:
-1 disable MP
-2 disable ACPI
2008-04-29 19:18:19 +00:00
joerg
a1988014f6 Remove IOAPIC_HWMASK, it was never defined. 2008-04-29 18:47:18 +00:00
yamt
5d9397e689 sprinkle KASSERT(kpreempt_disabled()). 2008-04-29 15:44:07 +00:00
yamt
20d35e839b make cpu_intr_p preemption safe. 2008-04-29 15:42:59 +00:00
martin
3028e483e4 Convert to new 2 clause license 2008-04-29 06:53:00 +00:00
ad
88a55035c6 Oops... EVCNT_TYPE_IPI -> EVCNT_TYPE_INTR. 2008-04-29 00:44:58 +00:00
ad
ffc4969f6e Don't count many items as EVCNT_TYPE_INTR because they clutter up the
systat vmstat display.
2008-04-28 23:00:22 +00:00
ad
104cf0ae89 Add support for kernel preeemption to the i386 and amd64 ports. Notes:
- I have seen one isolated panic in the x86 pmap, but otherwise i386
  seems stable with preemption enabled.

- amd64 is missing the FPU handling changes and it's not yet safe to
  enable it there.

- The usual level for kern.sched.kpreempt_pri will be 128 once enabled
  by default. For testing, setting it to 0 helps to shake out bugs.
2008-04-28 22:47:37 +00:00
martin
ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
ad
3d504986e5 Stray kpreempt_disable with no matching kpreempt_enable. 2008-04-28 17:18:19 +00:00
ad
a52d138523 cpu_idle: assert ilevel == IPL_NONE. 2008-04-28 13:10:22 +00:00
ad
5be927ae20 Make preemption safe. 2008-04-27 22:43:08 +00:00
ad
c76bdbff23 Sprinkle more assertions / preemption paranoia. 2008-04-27 22:41:15 +00:00
ad
27168d9d58 - Rename crit_enter/crit_exit to kpreempt_disable/kpreempt_enable.
DragonflyBSD uses the crit names for something quite different.
- Add a kpreempt_disabled function for diagnostic assertions.
- Add inline versions of kpreempt_enable/kpreempt_disable for primitives.
- Make some more changes for preemption safety to the x86 pmap.
2008-04-27 11:37:48 +00:00
ad
e33af2987c +lcr2 2008-04-27 11:25:27 +00:00
darcy
0669406131 Add a little more detail when verbosity is requested. 2008-04-26 15:13:00 +00:00
christos
0527f291b9 minor restructuring. 2008-04-25 17:41:10 +00:00
ad
1a1d0b7f30 Include null IPI functions if !MULTIPROCESSOR. 2008-04-25 13:26:27 +00:00
jmcneill
806f625216 Gracefully handle a condition where apic id >= X86_MAXPROCS rather than
panicing.
2008-04-24 15:59:57 +00:00
cegger
68519ac971 amdtemp(4): Driver for AMD CPU Temperature Sensors. Adopted from OpenBSD's kate(4).
Changes beyond OpenBSD's driver:
- Improved support for AMD K8
- Added support for AMD Barcelona, AMD Phenom and AMD Griffin
Tested on various single and multi-socket machines.
Review and OK xtreame
2008-04-22 22:37:12 +00:00
tls
822d920956 Commit a quick workaround for the not-power-of-two cache colors problem
pointed out by Simon (Simon's option #3): use the greatest power of two
which is a divisor of the desired number of cache colors.

This code might want to stay even after the cache probing code is fixed.
2008-04-22 02:23:05 +00:00
ad
a2249ef75c Make ntp, pmc, reboot, sysarch, time syscalls MPSAFE. 2008-04-21 12:56:30 +00:00
cegger
0f42d52a84 Make this build on Xen and MULTIPROCESSOR.
OK bouyer
2008-04-18 15:49:39 +00:00
cegger
e1f7ded34b g/c unused ioapic_bsp_id.
Per discussion with bouyer.
2008-04-18 15:32:46 +00:00
cegger
60fafd3b9b wrap long line. Requested and OK by simonb. 2008-04-17 18:45:08 +00:00
yamt
dc985aec9b cpu_debug_dump: s/curproc/curlwp/ in a message. 2008-04-17 14:01:03 +00:00
cegger
a92eb72e37 use aprint_*_dev.
OK simonb
2008-04-17 09:09:54 +00:00
cegger
467fe0c43b Add missing bracket. Fixes build for i386 ALL kernel. 2008-04-17 05:26:11 +00:00
cegger
5c97fc53e8 - use aprint_*_dev and device_xname
- use POSIX integer types
2008-04-16 16:06:51 +00:00
cegger
d6dfa07dd4 - u_int32_t -> uint32_t
- ansfiy
2008-04-14 05:52:34 +00:00
cegger
29ffadf779 use device accessors and other misc cleanups 2008-04-13 22:23:58 +00:00
cegger
2a02b38790 ansify 2008-04-12 19:49:54 +00:00
dyoung
9a6b7a1ccd Remove debug printf that snuck in with my commit. 2008-04-11 16:44:45 +00:00
dyoung
9fb0fb3f28 Add the redzones above and below the interrupt stack back to the
DIAGNOSTIC kernel.
2008-04-10 23:22:30 +00:00
cherry
f493ba9c7e Correct comment about struct timecounter field 2008-04-06 12:19:36 +00:00
jmcneill
8843b0cbbb Disable machdep.acpi_beep_on_reset by default. 2008-04-03 10:20:18 +00:00
ad
5e136e1e5d Add more error reporting to AP startup. 2008-04-02 11:52:54 +00:00
ad
138df53bd3 If MPDEBUG and waiting for the CPU to start, dump cpu_trace[] as it changes. 2008-04-01 11:09:58 +00:00
ad
26256b6233 If SMBIOS is present and there seems to be good expansion slot info,
note the number of ISA compatible slots.
2008-03-30 15:26:20 +00:00
jmcneill
b3ac884c36 Add RCSID to top of file. 2008-03-29 17:40:22 +00:00
xtraeme
d749da9154 Split device_t/softc for ichlpcib(4) and all hpet consumers, plus
other related cosmetic changes.
2008-03-21 13:25:27 +00:00
xtraeme
409a4c533c Split device_t/softc for amdpcib and the hpet attachment, plus other
related cosmetic changes.
2008-03-21 12:29:38 +00:00
dyoung
45361f4c9c Use device_t. 2008-03-21 00:24:34 +00:00
drochner
86d10efebd if "ddb_vgapost" is called but its data structures were not initialized,
print a message, suggested by joerg
(the message might be invisible if the console is in X mode)
2008-03-13 17:40:24 +00:00
drochner
3678498d59 -add a function to vga_post which can be called from DDB to get a
usable VGA console ("call ddb_vgapost")
-allow to switch from/to screens occupied by an X server if the graphics
 device is console and in polling mode (ie DDB)
This together allows to get a DDB session on a VGA console if the
system crashed while X11 was running.
As long as the protocol to tell X servers about virtual screen switches
is as primitive as it is, it is unsafe to restart an X session afterwards.
So this is basically for crash analysis.
2008-03-12 23:26:18 +00:00
joerg
aa717955e2 Use CPUID2EXTFAMILY and CPUID2EXTMODEL. 2008-03-11 22:43:08 +00:00
ad
907fdb3f79 Implement an optimized, preemption-safe asm version of tsc_get_timecount().
The C version needs work to be preemption safe. Cuts the clock cycles
for microtime() from 950 down to 300 on a Pentium D.
2008-03-10 22:03:40 +00:00
cube
49f644ac35 Cosmetics: use device_t and cfdata_t. 2008-03-05 22:47:53 +00:00
cube
0204653a11 Split device_t/softc and other related cosmetic changes. 2008-03-04 15:33:06 +00:00
cube
83be932a21 Split device_t/softc. 2008-03-04 15:24:02 +00:00
cube
e42e7941c2 sysbeep has no softc, use CFATTACH_DECL_NEW. 2008-03-04 14:38:05 +00:00
dyoung
41d64046d4 Use PMF_FN_ARGS, PMF_FN_PROTO. 2008-02-29 06:25:08 +00:00
drochner
69fd99f62d fix an unaligned PCI config space access for the P2 "BX" chipset 2008-02-28 18:51:18 +00:00
dyoung
d2cef052fc Add methods to detach self and children.
Use device_t and accessors.  Use aprint_*_dev().
2008-02-22 23:32:24 +00:00
bouyer
cc046e71a2 Minor optimisation: for Xen amd64, copy to kernel map only the entries from
user map that are needed.
2008-02-16 22:01:16 +00:00
joerg
4d4af868ab Garbage collect the remaining parts of COMPAT_OLDBOOT. The boot loader
support has been removed at least 4 years ago and NetBSD 1.3 is ancient.
2008-02-12 18:22:39 +00:00
joerg
e69482d49d Introduce device_find_by_xname and device_find_by_driver_unit to replace
alldevs iterations all over src.

Patch discussed with and improved on suggestioned from cube@.
2008-02-12 17:30:57 +00:00
ad
7210c1fef8 Align cc_microtime and struct cpu_info to 64b. 2008-02-10 14:37:41 +00:00
yamt
071f43904b constify. 2008-02-07 14:37:40 +00:00
xtraeme
430c4cd21f Add DTES64 and SSE4 related bits to CPUID2_FLAGS, from FreeBSD. 2008-02-03 06:19:06 +00:00
tls
9b6c682b45 From Darran Hunt at Coyote Point: don't truncate HMAC to 96 bits unless
actually asked to.

Fixed in FreeBSD a while ago, discussed on tech-kern and tech-crypto.
2008-02-02 02:39:00 +00:00
wiz
90783e5e06 Fix typo in comment. 2008-01-31 09:57:27 +00:00
yamt
195ce1f164 pmap_page_remove: add a reference to the pmap earlier and comment why. 2008-01-30 13:28:29 +00:00
yamt
008913ddc2 pmap_remove_ptes, pmap_remove_pte: fix a panic seen on pkgbuild,
reported by S.P.Zeidler.
after recent locking changes, these assertions are no longer true.
2008-01-30 13:26:09 +00:00
ad
3da93d9e92 splhigh == splipi 2008-01-30 09:02:46 +00:00
jmcneill
f5f534770c pmf: Naively track online/offline state of APs during suspend/resume. 2008-01-30 01:10:21 +00:00
xtraeme
1cc7b13a55 coretemp_refresh: run xc_unicast() regardless if sc->sc_ci is curcpu()
or not, this fixes a deadlock seen by Greg Oster in a Dual Quad Core
machine with 8 coretemp instances.
2008-01-28 22:49:49 +00:00
xtraeme
fd81136064 Pass the same size to both kmem_alloc(9) and kmem_free(9), this fixes
the kmem_poison_check in DEBUG kernels.
2008-01-28 20:19:06 +00:00
ad
2b43ec397e Enablel locking that was stubbed out. 2008-01-28 19:57:43 +00:00
yamt
12ff4ba098 save a word in pv_entry by making pv_hash SLIST.
although this can slow down pmap_sync_pv if hash lists get long,
we should keep them short anyway.
2008-01-28 11:06:42 +00:00
xtraeme
85adc21249 Some indentation for a few printfs that weren't respecting 80 chars
per line.
2008-01-25 18:56:55 +00:00
joerg
218115037a Simplify the calibration code a great bit by just waiting around 100ms
polling the i8254 as reference and counting the cycles with that.
Disable interrupts. This should be relatively stable even in the light
of SMIs as long as they happen in the middle of the loop. This fixes
long delays during boot.

If greater precision for the calibration is desired, a second run should
be done at a different time when the HPET or ACPI timer is present. Both
provide much faster access (less jitter) and a higher frequency.
2008-01-25 18:50:22 +00:00
jmcneill
f1caab8ba5 In ioapic_reenable, don't try to remap the apic id if it is already correct. 2008-01-24 22:20:58 +00:00