The NetBSD Project

CVS log for src/sys/arch/x86/include/cpu.h

[BACK] Up to [cvs.NetBSD.org] / src / sys / arch / x86 / include

Request diff between arbitrary revisions


Keyword substitution: kv
Default branch: MAIN


Revision 1.138: download - view: text, markup, annotated - select for diffs
Fri Dec 6 10:53:41 2024 UTC (7 days, 17 hours ago) by bouyer
Branches: MAIN
CVS tags: HEAD
Diff to: previous 1.137: preferred, colored
Changes since revision 1.137: +13 -1 lines
Introduce vm_guest_is_pvh() and use it in place of
	(vm_guest == VM_GUEST_XENPVH || vm_guest == VM_GUEST_GENPVH)

Revision 1.137: download - view: text, markup, annotated - select for diffs
Mon Dec 2 13:31:32 2024 UTC (11 days, 14 hours ago) by bouyer
Branches: MAIN
Diff to: previous 1.136: preferred, colored
Changes since revision 1.136: +2 -1 lines
Add support for non-Xen PVH guests to amd64. Patch from
Emile 'iMil' Heitor in PR kern/57813, with some cosmetic tweaks by me.
Tested on bare metal, Xen PV and Xen PVH by me.

Revision 1.133.4.1: download - view: text, markup, annotated - select for diffs
Wed Aug 9 17:42:01 2023 UTC (16 months ago) by martin
Branches: netbsd-10
CVS tags: netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1
Diff to: previous 1.133: preferred, colored; next MAIN 1.134: preferred, colored
Changes since revision 1.133: +5 -1 lines
Pull up following revision(s) (requested by maya in ticket #316):

	sys/arch/m68k/include/mutex.h: revision 1.13
	sys/arch/arm/include/cpu.h: revision 1.125
	sys/arch/sun68k/include/intr.h: revision 1.21
	sys/arch/arm/include/mutex.h: revision 1.28
	sys/sys/rwlock.h: revision 1.18
	sys/arch/powerpc/include/mutex.h: revision 1.7
	sys/arch/arm/include/mutex.h: revision 1.29
	sys/arch/powerpc/include/mutex.h: revision 1.8
	sys/uvm/uvm_param.h: revision 1.42
	sys/sys/ksem.h: revision 1.16
	sys/arch/x86/include/mutex.h: revision 1.10
	sys/sys/proc.h: revision 1.372
	sys/sys/ksem.h: revision 1.17
	sys/arch/ia64/include/mutex.h: revision 1.8
	sys/arch/evbarm/include/intr.h: revision 1.29
	sys/sys/lua.h: revision 1.9
	sys/arch/next68k/include/intr.h: revision 1.23
	sys/arch/ia64/include/mutex.h: revision 1.9
	sys/arch/hp300/include/intr.h: revision 1.35
	sys/arch/hp300/include/intr.h: revision 1.36
	sys/arch/sparc/include/cpu.h: revision 1.111
	sys/arch/hppa/include/mutex.h: revision 1.16
	sys/arch/vax/include/intr.h: revision 1.31
	sys/arch/hppa/include/mutex.h: revision 1.17
	sys/arch/news68k/include/intr.h: revision 1.28
	sys/arch/hppa/include/mutex.h: revision 1.18
	sys/arch/hppa/include/intr.h: revision 1.3
	sys/arch/hppa/include/mutex.h: revision 1.19
	sys/arch/hppa/include/intr.h: revision 1.4
	sys/sys/sched.h: revision 1.92
	sys/opencrypto/cryptodev.h: revision 1.51
	sys/arch/vax/include/mutex.h: revision 1.20
	sys/arch/sparc64/include/mutex.h: revision 1.10
	sys/arch/ia64/include/sapicvar.h: revision 1.2
	sys/arch/riscv/include/mutex.h: revision 1.5
	sys/arch/amiga/dev/grfabs_cc.c: revision 1.39
	sys/external/bsd/drm2/include/linux/idr.h: revision 1.11
	sys/arch/riscv/include/mutex.h: revision 1.6
	sys/ddb/files.ddb: revision 1.16
	sys/arch/mac68k/include/intr.h: revision 1.32
	share/man/man4/ddb.4: revision 1.203
	sys/ddb/db_command.c: revision 1.183
	sys/arch/mips/include/mutex.h: revision 1.10
	sys/ddb/db_command.c: revision 1.184
	sys/arch/x68k/include/intr.h: revision 1.22
	sys/arch/sparc/include/psl.h: revision 1.51
	sys/arch/or1k/include/mutex.h: revision 1.4
	sys/arch/mips/include/mutex.h: revision 1.11
	sys/arch/arm/xscale/pxa2x0_intr.h: revision 1.16
	sys/arch/sparc64/include/cpu.h: revision 1.134
	sys/arch/sparc/include/psl.h: revision 1.52
	sys/arch/or1k/include/mutex.h: revision 1.5
	sys/arch/mvme68k/include/intr.h: revision 1.22
	sys/arch/luna68k/include/intr.h: revision 1.16
	external/cddl/osnet/sys/sys/kcondvar.h: revision 1.6
	sys/arch/sparc/include/mutex.h: revision 1.12
	sys/arch/sparc/include/mutex.h: revision 1.13
	sys/arch/usermode/include/mutex.h: revision 1.5
	sys/arch/usermode/include/mutex.h: revision 1.6
	sys/kern/kern_core.c: revision 1.38
	usr.sbin/crash/Makefile: revision 1.49
	sys/arch/amiga/include/intr.h: revision 1.23
	sys/arch/alpha/include/mutex.h: revision 1.12
	sys/arch/alpha/include/mutex.h: revision 1.13
	sys/arch/evbarm/lubbock/sacc_obio.c: revision 1.16
	sys/ddb/ddb.h: revision 1.6
	sys/arch/sparc64/include/mutex.h: revision 1.8
	sys/arch/sh3/include/mutex.h: revision 1.12
	sys/arch/evbarm/lubbock/sacc_obio.c: revision 1.17
	sys/ddb/db_syncobj.c: revision 1.1
	sys/arch/vax/include/mutex.h: revision 1.18
	sys/arch/sparc64/include/psl.h: revision 1.63
	sys/arch/sparc64/include/mutex.h: revision 1.9
	sys/arch/sh3/include/mutex.h: revision 1.13
	sys/arch/evbarm/lubbock/obio.c: revision 1.13
	sys/arch/atari/include/intr.h: revision 1.23
	sys/ddb/db_syncobj.c: revision 1.2
	sys/arch/vax/include/mutex.h: revision 1.19
	sys/arch/evbarm/g42xxeb/obio.c: revision 1.14
	sys/arch/evbarm/g42xxeb/obio.c: revision 1.15
	sys/arch/cesfic/include/intr.h: revision 1.14
	sys/ddb/db_syncobj.h: revision 1.1
	sys/arch/x86/include/cpu.h: revision 1.134
	sys/arch/evbarm/g42xxeb/obio.c: revision 1.16
	sys/arch/cesfic/include/intr.h: revision 1.15
	sys/arch/arm/xscale/pxa2x0_intr.c: revision 1.26
	sys/sys/cpu_data.h: revision 1.54
	sys/arch/m68k/include/mutex.h: revision 1.12
	sys/arch/ia64/acpi/madt.c: revision 1.6

sys/rwlock.h: Make this more self-contained for bool.

machine/mutex.h: Sprinkle includes so this can be used by crash(8).

ddb: New `show all tstiles' command.
Shows who's waiting for which locks and what the owner is up to.

Include psl.h for ipl_cookie_t if __MUTEX_PRIVATE

sys: Rip <sys/resourcevar.h> out of <uvm/uvm_param.h>.

And thus out of <sys/param.h>, which is exceedingly overused and
fragile and delenda est.

Should fix (some) issues with the recent inclusion of machine/lock.h
in various machine/mutex.h files.

arm/mutex.h: Need machine/intr.h, machine/lock.h.

For ipl_cookie_t and __cpu_simple_lock_t.
evbarm/intr.h: Define ipl_cookie_t before including ARM_INTR_IMPL.

Otherwise arm/mutex.h doesn't work, due to a cyclic dependency which
should really be fixed.
opencrypto/cryptodev.h: Fix includes.
- Move sys/condvar.h under #ifdef _KERNEL.
- Add some other necessary includes and forward declarations.
- Sort.

hp300/intr.h: Fix missing includes.
linux/idr.h: Need <sys/mutex.h> for kmutex_t.
amiga/intr.h: Don't define spl*() functions if !_KERNEL.

This is used by crash(8) now, and what's important is ipl_cookie_t.
cesfic/intr.h: Expose ipl_cookie_t to userland for crash(8).
cesfic/intr.h: Expose ipl_cookie_t to userland only with _KMEMUSER.

Probably not necessary but let's be a little more cautious about
this.

atari/intr.h: Expose ipl_cookie_t with _KMEMUSER for crash(8).

arm/cpu.h: Need sys/param.h for COHERENCY_UNIT.

Nix machine/param.h -- not meant to be used directly, pulled in by
sys/param.h.

Move the definition of ipl_cookie_t out of the kernel-only sections,
some _KMEMUSER applications need it.

ddb: Cast pointer to uintptr_t first before db_expr_t.

hppa/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

luna68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

mvme68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

news68k/intr.h: Fix includes.  Put some definitions under _KERNEL.

next68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

sys/ksem.h: Hack around fstat(8) abuse of _KERNEL.

sun68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

vax/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

x68k/intr.h: Put functions under _KERNEL so crash(8) can use this.

Make ipl_cookie_t visible for _KMEMUSER userland applications.

fix editor mishap in previous

Explicitly include <sys/mutex.h> for kmutex_t.

Replace kmutex_t * (which may be undefined here) with struct kmutex *,
suggested by Taylor.

hp300/intr.h: Put most of this under #ifdef _KERNEL.
Only ipl_cookie_t really needs to be exposed now, for crash(8).

mac68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).
Make inclusion of sys/intr.h explicit for spl*.

fix hppa and vax builds.

machine/lock.h isn't necessary for __cpu_simple_lock_t, it's in
sys/types.h.  avoids cpu_data.h vs sched.h include order issues.

move the hppa ipl_t typedef with the moved usage of it.
machine/mutex.h: Sprinkle sys/types.h, omit machine/lock.h.

Turns out machine/lock.h is not needed for __cpu_simple_lock_t, which
always comes from sys/types.h.  And, really, sys/types.h (or at least
sys/stdint.h) is needed for uintN_t and uintptr_t.

ddb: Cast pointer to uintptr_t, then to db_expr_t.
Avoids warnings about conversion between pointer and integer of
different size on some architectures.

re-fix hppa builds.

this file uses __cpu_simple_lock(), not just the underlying type,
so it does need machine/lock.h.

Break cycle by using `struct kmutex *' instead of `kmutex_t *'.
sys/sched.h included sys/mutex.h
which includes sys/intr.h
which includes machine/intr.h
which on cats includes arm/footbridge/footbridge_intr.h
which includes arm/cpu.h
which includes sys/cpu_data.h
which includes sys/sched.h

But there was never any real need for sys/mutex.h in sys/sched.h,
because it only uses pointers to the opaque struct kmutex.  Cycle
broken by using `struct kmutex *' instead of pulling in sys/mutex.h
for the definition of kmutex_t.

Side effect: This revealed that sys/cpu_data.h needed sys/intr.h
(which was pulled in accidentally by sys/mutex.h via sys/sched.h) for
SOFTINT_COUNT.  Also revealed some other machine/cpu.h header files
were missing includes of sys/mutex.h for kmutex_t.

ia64: Need sys/types.h for u_int, vaddr_t; sys/mutex.h for kmutex_t.

explicitly include no longer implicitly included sys/mutex.h.

arm/xscale: Use sys/bitops.h fls32 - 1 instead of 31 - __builtin_clz.
Sidesteps namespace collision with `#define bits ...' in net/zlib.c.

complete the previous - there were two calls to find_first_bit() to fix.

arm/xscale: Missed a spot with previous find_first_bit commit.

evbarm/g42xxeb: Fix off-by-one in previous.

The original find_first_bit(x) was 31 - __builtin_clz((uint32_t)x),
which is equivalent to fls32(x) - 1, not to fls32(x).

Note that fls32 is 1-based and returns 0 for x=0.

Revision 1.136: download - view: text, markup, annotated - select for diffs
Tue Aug 1 19:36:57 2023 UTC (16 months, 1 week ago) by riastradh
Branches: MAIN
CVS tags: thorpej-ifq-base, thorpej-ifq, thorpej-altq-separation-base, thorpej-altq-separation, perseant-exfatfs-base-20240630, perseant-exfatfs-base, perseant-exfatfs
Diff to: previous 1.135: preferred, colored
Changes since revision 1.135: +2 -1 lines
xen: Report when hardclock jump exceeds timecounter(9) limit.

Revision 1.135: download - view: text, markup, annotated - select for diffs
Thu Jul 13 13:34:15 2023 UTC (17 months ago) by riastradh
Branches: MAIN
Diff to: previous 1.134: preferred, colored
Changes since revision 1.134: +2 -1 lines
xen: Record event when local view of timecounter is behind global.

Revision 1.134: download - view: text, markup, annotated - select for diffs
Thu Jul 13 12:06:20 2023 UTC (17 months ago) by riastradh
Branches: MAIN
Diff to: previous 1.133: preferred, colored
Changes since revision 1.133: +5 -1 lines
Break cycle by using `struct kmutex *' instead of `kmutex_t *'.

sys/sched.h included sys/mutex.h
which includes sys/intr.h
which includes machine/intr.h
which on cats includes arm/footbridge/footbridge_intr.h
which includes arm/cpu.h
which includes sys/cpu_data.h
which includes sys/sched.h

But there was never any real need for sys/mutex.h in sys/sched.h,
because it only uses pointers to the opaque struct kmutex.  Cycle
broken by using `struct kmutex *' instead of pulling in sys/mutex.h
for the definition of kmutex_t.

Side effect: This revealed that sys/cpu_data.h needed sys/intr.h
(which was pulled in accidentally by sys/mutex.h via sys/sched.h) for
SOFTINT_COUNT.  Also revealed some other machine/cpu.h header files
were missing includes of sys/mutex.h for kmutex_t.

Revision 1.133: download - view: text, markup, annotated - select for diffs
Wed Sep 7 00:40:18 2022 UTC (2 years, 3 months ago) by knakahara
Branches: MAIN
CVS tags: netbsd-10-base, bouyer-sunxi-drm-base, bouyer-sunxi-drm
Branch point for: netbsd-10
Diff to: previous 1.132: preferred, colored
Changes since revision 1.132: +12 -11 lines
NetBSD/x86: Raise the number of interrupt sources per CPU from 32 to 56.

There has been no objection for three years.
    https://mail-index.netbsd.org/port-amd64/2019/09/22/msg003012.html
Implemented by nonaka@n.o, updated by me.

Revision 1.71.2.10: download - view: text, markup, annotated - select for diffs
Fri Dec 24 13:02:25 2021 UTC (2 years, 11 months ago) by martin
Branches: netbsd-8
CVS tags: netbsd-8-3-RELEASE
Diff to: previous 1.71.2.9: preferred, colored; branchpoint 1.71: preferred, colored; next MAIN 1.72: preferred, colored
Changes since revision 1.71.2.9: +2 -1 lines
Pull up the following (all via patch), requested by msaitoh in ticket #1721:

	usr.sbin/cpuctl/arch/i386.c			1.118-1.119, 1.121-1.122
	usr.sbin/cpuctl/arch/cpuctl_i386.h		1.6
	sys/arch/x86/x86/identcpu_subr.c		1.8-1.9
	sys/arch/x86/x86/identcpu.c			1.123
	sys/arch/x86/include/cacheinfo.h		1.30
	sys/arch/x86/include/cpu.h			1.132

- Fix a bug that some TLB related lines were not printed.
- Fix a bug that STLB is printed as DTLB.
- If a TLB is variable sized, print the max size instead of error message.
- Cosmetic changes to improve readability.

Revision 1.107.2.2: download - view: text, markup, annotated - select for diffs
Fri Dec 24 12:58:14 2021 UTC (2 years, 11 months ago) by martin
Branches: netbsd-9
CVS tags: netbsd-9-4-RELEASE, netbsd-9-3-RELEASE
Diff to: previous 1.107.2.1: preferred, colored; branchpoint 1.107: preferred, colored; next MAIN 1.108: preferred, colored
Changes since revision 1.107.2.1: +2 -1 lines
Pull up the following (all via patch), requested by msaitoh in ticket #1396:

	usr.sbin/cpuctl/arch/i386.c			1.118-1.119, 1.121-1.122
	usr.sbin/cpuctl/arch/cpuctl_i386.h		1.6
	sys/arch/x86/x86/identcpu_subr.c		1.8-1.9
	sys/arch/x86/x86/identcpu.c			1.123
	sys/arch/x86/include/cacheinfo.h		1.30
	sys/arch/x86/include/cpu.h			1.132

- Fix a bug that some TLB related lines were not printed.
- Fix a bug that STLB is printed as DTLB.
- If a TLB is variable sized, print the max size instead of error message.
- Cosmetic changes to improve readability.

Revision 1.132: download - view: text, markup, annotated - select for diffs
Thu Oct 7 13:04:18 2021 UTC (3 years, 2 months ago) by msaitoh
Branches: MAIN
Diff to: previous 1.131: preferred, colored
Changes since revision 1.131: +2 -1 lines
Move some common functions into x86/identcpu_subr.c. No functional change.

Revision 1.131: download - view: text, markup, annotated - select for diffs
Sat Aug 14 17:51:20 2021 UTC (3 years, 4 months ago) by ryo
Branches: MAIN
Diff to: previous 1.130: preferred, colored
Changes since revision 1.130: +5 -1 lines
Improved the performance of kernel profiling on MULTIPROCESSOR, and possible to get profiling data for each CPU.

In the current implementation, locks are acquired at the entrance of the mcount
internal function, so the higher the number of cores, the more lock conflict
occurs, making profiling performance in a MULTIPROCESSOR environment unusable
and slow. Profiling buffers has been changed to be reserved for each CPU,
improving profiling performance in MP by several to several dozen times.

- Eliminated cpu_simple_lock in mcount internal function, using per-CPU buffers.
- Add ci_gmon member to struct cpu_info of each MP arch.
- Add kern.profiling.percpu node in sysctl tree.
- Add new -c <cpuid> option to kgmon(8) to specify the cpuid, like openbsd.
  For compatibility, if the -c option is not specified, the entire system can be
  operated as before, and the -p option will get the total profiling data for
  all CPUs.

Revision 1.129.2.1: download - view: text, markup, annotated - select for diffs
Sat Apr 3 22:28:41 2021 UTC (3 years, 8 months ago) by thorpej
Branches: thorpej-futex
Diff to: previous 1.129: preferred, colored; next MAIN 1.130: preferred, colored
Changes since revision 1.129: +2 -1 lines
Sync with HEAD.

Revision 1.130: download - view: text, markup, annotated - select for diffs
Fri Feb 19 02:15:24 2021 UTC (3 years, 9 months ago) by christos
Branches: MAIN
CVS tags: thorpej-i2c-spi-conf2-base, thorpej-i2c-spi-conf2, thorpej-i2c-spi-conf-base, thorpej-i2c-spi-conf, thorpej-futex2-base, thorpej-futex2, thorpej-futex-base, thorpej-cfargs2-base, thorpej-cfargs2, thorpej-cfargs-base, thorpej-cfargs, cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Diff to: previous 1.129: preferred, colored
Changes since revision 1.129: +2 -1 lines
Identify VirtualBox as a separate guest type.

Revision 1.129: download - view: text, markup, annotated - select for diffs
Sat Aug 8 19:08:48 2020 UTC (4 years, 4 months ago) by christos
Branches: MAIN
Branch point for: thorpej-futex
Diff to: previous 1.128: preferred, colored
Changes since revision 1.128: +2 -1 lines
PR/55547: Dan Plassche: Fix BSD/OS binary emulation.
Centralize lcall sniffer and recognize the BSD/OS flavor.

Revision 1.71.2.9: download - view: text, markup, annotated - select for diffs
Wed Aug 5 16:20:08 2020 UTC (4 years, 4 months ago) by martin
Branches: netbsd-8
Diff to: previous 1.71.2.8: preferred, colored; branchpoint 1.71: preferred, colored
Changes since revision 1.71.2.8: +4 -1 lines
Pull up the following revisions, requested by msaitoh in ticket #1593:

	sys/arch/x86/conf/files.x86			1.108
	sys/arch/x86/include/apicvar.h			1.7 via patch
	sys/arch/x86/include/cpu.h			1.121
	sys/arch/x86/x86/cpu.c				1.185 via patch
	sys/arch/x86/x86/hyperv.c			1.7
	sys/arch/x86/x86/tsc.c				1.41
	sys/arch/xen/conf/files.xen			1.181

Get TSC frequency from CPUID 0x15 and/or x16 if it's available.
This change fixes a problem that newer Intel processors' timer
counts very slowly.

Revision 1.128: download - view: text, markup, annotated - select for diffs
Sun Jul 19 13:55:09 2020 UTC (4 years, 4 months ago) by maxv
Branches: MAIN
Diff to: previous 1.127: preferred, colored
Changes since revision 1.127: +1 -4 lines
don't include opt_user_ldt.h when it is not needed

Revision 1.107.2.1: download - view: text, markup, annotated - select for diffs
Wed Jul 15 17:25:08 2020 UTC (4 years, 5 months ago) by martin
Branches: netbsd-9
CVS tags: netbsd-9-2-RELEASE, netbsd-9-1-RELEASE
Diff to: previous 1.107: preferred, colored
Changes since revision 1.107: +4 -1 lines
Pull up the following, requested by msaitoh in ticket #1015

	sys/arch/x86/conf/files.x86			1.108 (via patch)
	sys/arch/x86/include/apicvar.h			1.7 (via patch)
	sys/arch/x86/include/cpu.h			1.121 (via patch)
	sys/arch/x86/x86/cpu.c				1.185 (via patch)
	sys/arch/x86/x86/hyperv.c			1.7 (via patch)
	sys/arch/x86/x86/tsc.c				1.41 (via patch)
	sys/arch/xen/conf/files.xen			1.181 (via patch)

Get TSC frequency from CPUID 0x15 and/or x16 if it's available.
This change fixes a problem that newer Intel processors' timer
counts very slowly.

Revision 1.127: download - view: text, markup, annotated - select for diffs
Tue Jul 14 00:45:53 2020 UTC (4 years, 5 months ago) by yamaguchi
Branches: MAIN
Diff to: previous 1.126: preferred, colored
Changes since revision 1.126: +8 -1 lines
Introduce per-cpu IDTs

This is realized by following modifications:
- Add IDT pages and its allocation maps for each cpu in "struct cpu_info"
- Load per-cpu IDTs at cpu_init_idt(struct cpu_info*)
- Copy the IDT entries for cpu0 to other CPUs at attach
   - These are, for example, exceptions, db, system calls, etc.

And, added a kernel option named PCPU_IDT to enable the feature.

Revision 1.126: download - view: text, markup, annotated - select for diffs
Fri Jun 19 16:20:22 2020 UTC (4 years, 5 months ago) by maxv
Branches: MAIN
Diff to: previous 1.125: preferred, colored
Changes since revision 1.125: +1 -7 lines
localify

Revision 1.125: download - view: text, markup, annotated - select for diffs
Sat May 2 16:44:35 2020 UTC (4 years, 7 months ago) by bouyer
Branches: MAIN
Diff to: previous 1.124: preferred, colored
Changes since revision 1.124: +13 -1 lines
Introduce Xen PVH support in GENERIC.
This is compiled in with
options XENPVHVM
x86 changes:
- add Xen section and xen pvh entry points to locore.S. Set vm_guest
  to VM_GUEST_XENPVH in this entry point.
  Most of the boot procedure (especially page table setup and switch to
  paged mode) is shared with native.
- change some x86_delay() to delay_func(), which points to x86_delay() for
  native/HVM, and xen_delay() for PVH

Xen changes:
- remove Xen bits from init_x86_64_ksyms() and init386_ksyms()
  and move to xen_init_ksyms(), used for both PV and PVH
- set ISA no-legacy-devices property for PVH
- factor out code from Xen's cpu_bootconf() to xen_bootconf()
  in xen_machdep.c
- set up a specific pvh_consinit() which starts with printk()
  (which uses a simple hypercall that is available early) and switch to
  xencons when we can use pmap_kenter_pa().

Revision 1.124: download - view: text, markup, annotated - select for diffs
Thu Apr 30 22:05:17 2020 UTC (4 years, 7 months ago) by bouyer
Branches: MAIN
Diff to: previous 1.123: preferred, colored
Changes since revision 1.123: +3 -2 lines
Don't #include xen/intrdefs.h is !XEN.
Should fix third-party module builds (e.g. virtualbox)

Revision 1.123: download - view: text, markup, annotated - select for diffs
Mon Apr 27 16:29:17 2020 UTC (4 years, 7 months ago) by bouyer
Branches: MAIN
Diff to: previous 1.122: preferred, colored
Changes since revision 1.122: +2 -4 lines
Move ci_vcpu under the #ifdef XEN section at the end of the struct cpu_info.
Hopefully will fix the nvmm module.

Revision 1.122: download - view: text, markup, annotated - select for diffs
Sat Apr 25 15:26:18 2020 UTC (4 years, 7 months ago) by bouyer
Branches: MAIN
Diff to: previous 1.121: preferred, colored
Changes since revision 1.121: +27 -14 lines
Merge the bouyer-xenpvh branch, bringing in Xen PV drivers support under HVM
guests in GENERIC.
Xen support can be disabled at runtime with
boot -c
disable hypervisor

Revision 1.117.4.7: download - view: text, markup, annotated - select for diffs
Sat Apr 25 11:23:57 2020 UTC (4 years, 7 months ago) by bouyer
Branches: bouyer-xenpvh
Diff to: previous 1.117.4.6: preferred, colored; branchpoint 1.117: preferred, colored; next MAIN 1.118: preferred, colored
Changes since revision 1.117.4.6: +4 -1 lines
Sync with bouyer-xenpvh-base2 (HEAD)

Revision 1.92.2.3: download - view: text, markup, annotated - select for diffs
Tue Apr 21 18:42:12 2020 UTC (4 years, 7 months ago) by martin
Branches: phil-wifi
Diff to: previous 1.92.2.2: preferred, colored; branchpoint 1.92: preferred, colored; next MAIN 1.93: preferred, colored
Changes since revision 1.92.2.2: +3 -3 lines
Sync with HEAD

Revision 1.121: download - view: text, markup, annotated - select for diffs
Tue Apr 21 02:56:37 2020 UTC (4 years, 7 months ago) by msaitoh
Branches: MAIN
CVS tags: phil-wifi-20200421, bouyer-xenpvh-base2
Diff to: previous 1.120: preferred, colored
Changes since revision 1.120: +4 -1 lines
Get TSC frequency from CPUID 0x15 and/or x16 for newer Intel processors.

 - If the max CPUID leaf is >= 0x15, take TSC value from CPUID. Some processors
   can take TSC/core crystal clock ratio but core crystal clock frequency
   can't be taken. Intel SDM give us the values for some processors.
 - It also required to change lapic_per_second to make LAPIC timer correctly.
 - Add new file x86/x86/identcpu_subr.c to share common subroutines between
   kernel and userland. Some code in x86/x86/identcpu.c and cpuctl/arch/i386.c
   will be moved to this file in future.
 - Add comment to clarify.

Revision 1.117.4.6: download - view: text, markup, annotated - select for diffs
Sat Apr 18 15:06:18 2020 UTC (4 years, 7 months ago) by bouyer
Branches: bouyer-xenpvh
Diff to: previous 1.117.4.5: preferred, colored; branchpoint 1.117: preferred, colored
Changes since revision 1.117.4.5: +3 -1 lines
Add PVHVM multiprocessor support:
We need the hypervisor to be set up before cpus attaches.
Move hypervisor setup to a new function xen_hvm_init(), called at the
beggining of mainbus_attach(). This function searches the cfdata[] array
to see if the hypervisor device is enabled (so you can disable PV
support with
disable hypervisor
from userconf).
For HVM, ci_cpuid doens't match the virtual CPU index needed by Xen.
Introduce ci_vcpuid to cpu_info. Introduce xen_hvm_init_cpu(), to be
called for each CPU in in its context, which initialize ci_vcpuid and
ci_vcpu, and setup the event callback.
Change Xen code to use ci_vcpuid.

Do not call lapic_calibrate_timer() for VM_GUEST_XENPVHVM, we will use
Xen timers.

Don't call lapic_initclocks() from cpu_hatch(); instead set
x86_cpu_initclock_func to lapic_initclocks() in lapic_calibrate_timer(),
and call *(x86_cpu_initclock_func)() from cpu_hatch().
Also call x86_cpu_initclock_func from cpu_attach() for the boot CPU.
As x86_cpu_initclock_func is called for all CPUs, x86_initclock_func can
be a NOP for lapic timer.

Reorganize Xen code for x86_initclock_func/x86_cpu_initclock_func.
Move x86_cpu_idle_xen() to hypervisor_machdep.c

Revision 1.117.4.5: download - view: text, markup, annotated - select for diffs
Thu Apr 16 17:44:54 2020 UTC (4 years, 7 months ago) by bouyer
Branches: bouyer-xenpvh
Diff to: previous 1.117.4.4: preferred, colored; branchpoint 1.117: preferred, colored
Changes since revision 1.117.4.4: +9 -8 lines
Avoid overflow of ci_ipi_events[] in the PVHVM case (it's size is
XEN_NIPIS but we use x86 IPIs): size XEN_NIPIS only for PV, and
CTASSERT that XEN_NIPIS <= X86_NIPI if we ever use Xen IPIs for
PVHVM.

Revision 1.120: download - view: text, markup, annotated - select for diffs
Mon Apr 13 22:54:11 2020 UTC (4 years, 8 months ago) by bouyer
Branches: MAIN
CVS tags: bouyer-xenpvh-base1
Diff to: previous 1.119: preferred, colored
Changes since revision 1.119: +1 -4 lines
By default, events are bound to CPU 0 (exept for IPIs and VTIMERs which
are bound to a different CPU at creation time).
Recent MI changes caused the scheduler to choose a different CPU when
probing and attaching xennet devices (I guess it's the xenbus thread which
runs on a different CPU). This cause the callback to be called on a different
CPU than the one expected by the kernel, and the event is ignored.
It is handled when the clock causes the callback to be called on the right
CPU, which is why xennet still run, but slowly.

Change event_set_handler() to do a EVTCHNOP_bind_vcpu if requested to,
and make sure we don't do it for IPIs and VIRQs (for theses, the op fails).

Revision 1.92.2.2: download - view: text, markup, annotated - select for diffs
Mon Apr 13 08:04:11 2020 UTC (4 years, 8 months ago) by martin
Branches: phil-wifi
Diff to: previous 1.92.2.1: preferred, colored; branchpoint 1.92: preferred, colored
Changes since revision 1.92.2.1: +37 -25 lines
Mostly merge changes from HEAD upto 20200411

Revision 1.117.4.4: download - view: text, markup, annotated - select for diffs
Sun Apr 12 17:25:52 2020 UTC (4 years, 8 months ago) by bouyer
Branches: bouyer-xenpvh
Diff to: previous 1.117.4.3: preferred, colored; branchpoint 1.117: preferred, colored
Changes since revision 1.117.4.3: +1 -7 lines
Get rid of xen-specific ci_x* interrupt handling:
- use the general SIR mechanism, reserving 3 more slots for IPL_VM, IPL_SCHED
  and IPL_HIGH
- remove specific handling from C sources, or change to ipending
- convert IPL number to SIR number in various places
- Remove XUNMASK/XPENDING in assembly or change to IUNMASK/IPENDING
- remove Xen-specific ci_xsources, ci_xmask, ci_xunmask, ci_xpending from
  struct cpu_info
- for now remove a KASSERT that there are no pending interrupts in
  idle_block(). We can get there with some software interrupts pending
  in autoconf XXX needs to be looked at.

Revision 1.117.4.3: download - view: text, markup, annotated - select for diffs
Sat Apr 11 10:11:31 2020 UTC (4 years, 8 months ago) by bouyer
Branches: bouyer-xenpvh
Diff to: previous 1.117.4.2: preferred, colored; branchpoint 1.117: preferred, colored
Changes since revision 1.117.4.2: +1 -3 lines
Include ci_isources[] for XenPV too.
Adjust spllower() to XenPV needs, and switch XenPV to the native spllower().
Remove xen_spllower().

Revision 1.117.4.2: download - view: text, markup, annotated - select for diffs
Fri Apr 10 14:37:54 2020 UTC (4 years, 8 months ago) by bouyer
Branches: bouyer-xenpvh
Diff to: previous 1.117.4.1: preferred, colored; branchpoint 1.117: preferred, colored
Changes since revision 1.117.4.1: +14 -1 lines
Skip cx8_spllower patch if we're running on any form of Xen PV,
we can't handle PV interrupts with a single atomic op here.
Enable x86_patch() for Xen too.

Revision 1.119: download - view: text, markup, annotated - select for diffs
Fri Apr 10 14:35:26 2020 UTC (4 years, 8 months ago) by bouyer
Branches: MAIN
CVS tags: phil-wifi-20200411
Diff to: previous 1.118: preferred, colored
Changes since revision 1.118: +0 -13 lines
Revert, wrong branch

Revision 1.118: download - view: text, markup, annotated - select for diffs
Fri Apr 10 14:34:27 2020 UTC (4 years, 8 months ago) by bouyer
Branches: MAIN
Diff to: previous 1.117: preferred, colored
Changes since revision 1.117: +14 -1 lines
Skip cx8_spllower patch if we're running on any form of Xen PV,
we can't handle PV interrupts with a single atomic op here.
Enable x86_patch() for Xen too.

Revision 1.117.4.1: download - view: text, markup, annotated - select for diffs
Wed Apr 8 17:59:16 2020 UTC (4 years, 8 months ago) by bouyer
Branches: bouyer-xenpvh
Diff to: previous 1.117: preferred, colored
Changes since revision 1.117: +4 -2 lines
Remove VM_GUEST_XEN and define only Xen subtypes:
VM_GUEST_XENPV
VM_GUEST_XENPVH
VM_GUEST_XENHVM
VM_GUEST_XENPVHVM

Set vm_guest in the start routine, if it is hypervisor-specific (e.g Xen PV).
If vm_guest was not set early and we detect Xen in identify_hypervisor(),
assume it is VM_GUEST_XENHVM. Refine to VM_GUEST_PVXENHVM in
hypervisor_match().

Revision 1.116.2.1: download - view: text, markup, annotated - select for diffs
Fri Jan 17 21:47:28 2020 UTC (4 years, 10 months ago) by ad
Branches: ad-namecache
Diff to: previous 1.116: preferred, colored; next MAIN 1.117: preferred, colored
Changes since revision 1.116: +2 -2 lines
Sync with head.

Revision 1.117: download - view: text, markup, annotated - select for diffs
Wed Jan 15 13:22:03 2020 UTC (4 years, 11 months ago) by ad
Branches: MAIN
CVS tags: phil-wifi-20200406, is-mlppp-base, is-mlppp, bouyer-xenpvh-base, ad-namecache-base3, ad-namecache-base2, ad-namecache-base1
Branch point for: bouyer-xenpvh
Diff to: previous 1.116: preferred, colored
Changes since revision 1.116: +2 -2 lines
Push the INVLPG limit for shootdowns up to 16 (for UBC).

Revision 1.116: download - view: text, markup, annotated - select for diffs
Mon Dec 30 23:32:29 2019 UTC (4 years, 11 months ago) by thorpej
Branches: MAIN
CVS tags: ad-namecache-base
Branch point for: ad-namecache
Diff to: previous 1.115: preferred, colored
Changes since revision 1.115: +3 -1 lines
Fix a problem with intr_unmask() that can cause a forever-loop:
- When handling the source-is-masked case in the interrupt vector, set the
  interrupt bit in a new ci_imasked field and ensure the bit is cleared
  from ci_ipending.
- In intr_unmask(), transfer the bit from ci_imasked to ci_ipending for
  non-level-sensitive interrupts (the PIC does the work for us in the
  level-sensitive case), and only force pending interrupts to be processed
  in this case.  (In all cases, make sure the now-unmasked bit is cleared
  from ci_imasked.)

Before, the bit was left in ci_ipending so as not to use edge-triggered
interrupts while the source is masked, but Xspllower() relies on the
pending bits getting cleared.

Tested by forcing all wm(4) interrupts on my test system though an
intr_mask() / softint / intr_unmask() cycle and exercising the network
heavily.

Revision 1.115: download - view: text, markup, annotated - select for diffs
Sun Dec 1 15:34:46 2019 UTC (5 years ago) by ad
Branches: MAIN
Diff to: previous 1.114: preferred, colored
Changes since revision 1.114: +27 -16 lines
Fix false sharing problems with cpu_info.  Identified with tprof(8).
This was a very nice win in my tests on a 48 CPU box.

- Reorganise cpu_data slightly according to usage.
- Put cpu_onproc into struct cpu_info alongside ci_curlwp (now is ci_onproc).
- On x86, put some items in their own cache lines according to usage, like
  the IPI bitmask and ci_want_resched.

Revision 1.114: download - view: text, markup, annotated - select for diffs
Wed Nov 27 06:24:33 2019 UTC (5 years ago) by maxv
Branches: MAIN
Diff to: previous 1.113: preferred, colored
Changes since revision 1.113: +3 -1 lines
Add a small API for in-kernel FPU operations.

	fpu_kern_enter();
	/* do FPU stuff */
	fpu_kern_leave();

Revision 1.113: download - view: text, markup, annotated - select for diffs
Sat Nov 23 19:40:37 2019 UTC (5 years ago) by ad
Branches: MAIN
Diff to: previous 1.112: preferred, colored
Changes since revision 1.112: +2 -6 lines
cpu_need_resched():

- Remove all code that should be MI, leaving the bare minimum under arch/.
- Make the required actions very explicit.
- Pass in LWP pointer for convenience.
- When a trap is required on another CPU, have the IPI set it locally.
- Expunge cpu_did_resched().

Revision 1.112: download - view: text, markup, annotated - select for diffs
Thu Nov 21 21:48:33 2019 UTC (5 years ago) by ad
Branches: MAIN
Diff to: previous 1.111: preferred, colored
Changes since revision 1.111: +4 -2 lines
x86 TLB shootdown IPI changes:

- Shave some time off processing.
- Reduce cacheline/bus traffic on systems with many CPUs.
- Reduce time spent at IPL_VM.

Revision 1.111: download - view: text, markup, annotated - select for diffs
Thu Nov 21 19:57:24 2019 UTC (5 years ago) by ad
Branches: MAIN
Diff to: previous 1.110: preferred, colored
Changes since revision 1.110: +1 -2 lines
mi_userret(): take care of calling preempt(), set spc_curpriority directly,
and remove MD code that does the same.

Revision 1.110: download - view: text, markup, annotated - select for diffs
Sat Oct 12 06:31:03 2019 UTC (5 years, 2 months ago) by maxv
Branches: MAIN
CVS tags: phil-wifi-20191119
Diff to: previous 1.109: preferred, colored
Changes since revision 1.109: +1 -2 lines
Rewrite the FPU code on x86. This greatly simplifies the logic and removes
the dependency on IPL_HIGH. NVMM is updated accordingly. Posted on
port-amd64 a week ago.

Bump the kernel version to 9.99.16.

Revision 1.109: download - view: text, markup, annotated - select for diffs
Thu Oct 3 05:06:29 2019 UTC (5 years, 2 months ago) by maxv
Branches: MAIN
Diff to: previous 1.108: preferred, colored
Changes since revision 1.108: +1 -2 lines
Remove the LazyFPU code, as posted 5 months ago on port-amd64@.

Revision 1.108: download - view: text, markup, annotated - select for diffs
Wed Aug 7 06:23:48 2019 UTC (5 years, 4 months ago) by maxv
Branches: MAIN
Diff to: previous 1.107: preferred, colored
Changes since revision 1.107: +2 -2 lines
Add support for USER_LDT in SVS. This allows us to have both enabled at
the same time.

We allocate an LDT for each CPU in the GDT and map an area for it, in
addition to the default LDT already present. In context switches between
different processes, we choose between the default or the per-cpu LDT
selector: if the user set specific LDT entries, we memcpy them to the
per-cpu LDT and load the per-cpu selector.

Tested by Naveen Narayanan (with Wine on amd64).

Revision 1.107: download - view: text, markup, annotated - select for diffs
Wed Jun 26 12:29:00 2019 UTC (5 years, 5 months ago) by mgorny
Branches: MAIN
CVS tags: netbsd-9-base, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1
Branch point for: netbsd-9
Diff to: previous 1.106: preferred, colored
Changes since revision 1.106: +3 -1 lines
Fetch XSAVE area component offsets and sizes when initializing x86 CPU

Introduce two new arrays, x86_xsave_offsets and x86_xsave_sizes,
and initialize them with XSAVE area component offsets and sizes queried
via CPUID.  This will be needed to implement getters and setters for
additional register types.

While at it, add XSAVE_* constants corresponding to specific XSAVE
components.

Revision 1.92.2.1: download - view: text, markup, annotated - select for diffs
Mon Jun 10 22:06:53 2019 UTC (5 years, 6 months ago) by christos
Branches: phil-wifi
Diff to: previous 1.92: preferred, colored
Changes since revision 1.92: +116 -73 lines
Sync with HEAD

Revision 1.106: download - view: text, markup, annotated - select for diffs
Mon May 27 17:32:36 2019 UTC (5 years, 6 months ago) by maxv
Branches: MAIN
CVS tags: phil-wifi-20190609
Diff to: previous 1.105: preferred, colored
Changes since revision 1.105: +2 -2 lines
Remove 'ci_svs_kpdirpa', unused. While here fix a few comments here and
there, reduces a future diff.

Revision 1.71.2.8: download - view: text, markup, annotated - select for diffs
Sat Mar 9 17:10:20 2019 UTC (5 years, 9 months ago) by martin
Branches: netbsd-8
CVS tags: netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1
Diff to: previous 1.71.2.7: preferred, colored; branchpoint 1.71: preferred, colored
Changes since revision 1.71.2.7: +3 -1 lines
Pull up following revision(s) via patch (requested by nonaka in ticket #1210):

	sys/dev/hyperv/vmbusvar.h: revision 1.1
	sys/dev/hyperv/hvs.c: revision 1.1
	sys/dev/hyperv/if_hvn.c: revision 1.1
	sys/dev/hyperv/vmbusic.c: revision 1.1
	sys/arch/x86/x86/lapic.c: revision 1.69
	sys/arch/x86/isa/clock.c: revision 1.34
	sys/arch/x86/include/intrdefs.h: revision 1.22
	sys/arch/i386/conf/GENERIC: revision 1.1201
	sys/arch/x86/x86/hyperv.c: revision 1.1
	sys/arch/x86/include/cpu.h: revision 1.105
	sys/arch/x86/x86/x86_machdep.c: revision 1.124
	sys/arch/i386/conf/GENERIC: revision 1.1203
	sys/arch/amd64/amd64/genassym.cf: revision 1.74
	sys/arch/i386/conf/GENERIC: revision 1.1204
	sys/arch/amd64/conf/GENERIC: revision 1.520
	sys/arch/x86/x86/hypervreg.h: revision 1.1
	sys/arch/amd64/amd64/vector.S: revision 1.69
	sys/dev/hyperv/hvshutdown.c: revision 1.1
	sys/dev/hyperv/hvshutdown.c: revision 1.2
	sys/dev/usb/if_urndisreg.h: file removal
	sys/arch/x86/x86/cpu.c: revision 1.167
	sys/arch/x86/conf/files.x86: revision 1.107
	sys/dev/usb/if_urndis.c: revision 1.20
	sys/dev/hyperv/vmbusicreg.h: revision 1.1
	sys/dev/hyperv/hvheartbeat.c: revision 1.1
	sys/dev/hyperv/vmbusicreg.h: revision 1.2
	sys/dev/hyperv/hvheartbeat.c: revision 1.2
	sys/dev/hyperv/files.hyperv: revision 1.1
	sys/dev/ic/rndisreg.h: revision 1.1
	sys/arch/i386/i386/genassym.cf: revision 1.111
	sys/dev/ic/rndisreg.h: revision 1.2
	sys/dev/hyperv/hyperv_common.c: revision 1.1
	sys/dev/hyperv/hvtimesync.c: revision 1.1
	sys/dev/hyperv/hypervreg.h: revision 1.1
	sys/dev/hyperv/hvtimesync.c: revision 1.2
	sys/dev/hyperv/vmbusicvar.h: revision 1.1
	sys/dev/hyperv/if_hvnreg.h: revision 1.1
	sys/arch/x86/x86/lapic.c: revision 1.70
	sys/arch/amd64/amd64/vector.S: revision 1.70
	sys/dev/ic/ndisreg.h: revision 1.1
	sys/arch/amd64/conf/GENERIC: revision 1.516
	sys/dev/hyperv/hypervvar.h: revision 1.1
	sys/arch/amd64/conf/GENERIC: revision 1.518
	sys/arch/amd64/conf/GENERIC: revision 1.519
	sys/arch/i386/conf/files.i386: revision 1.400
	sys/dev/acpi/vmbus_acpi.c: revision 1.1
	sys/dev/hyperv/vmbus.c: revision 1.1
	sys/dev/hyperv/vmbus.c: revision 1.2
	sys/arch/x86/x86/intr.c: revision 1.144
	sys/arch/i386/i386/vector.S: revision 1.83
	sys/arch/amd64/conf/files.amd64: revision 1.112

separate RNDIS definitions from urndis(4) for use with Hyper-V NetVSC.

 -

Added Microsoft Hyper-V support.  It ported from OpenBSD and FreeBSD.
graphical console is not work on Gen.2 VM yet. To use the serial console,
enter "consdev com,0x3f8,115200" on efiboot.

 -

Add __diagused.

 -

PR/53984: Partial revert of modify lapic_calibrate_timer() in lapic.c r1.69.

 -

Update Hyper-V related drivers description.

 -

Remove unused definition.

 -

Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.
NFCI intended.

 -

commented out hvkvp entry.

 -

fix typo. pointed out by pgoyette@n.o.

 -

Use IDTVEC instead of NENTRY for handle_hyperv_hypercall.

 -

Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

Revision 1.105: download - view: text, markup, annotated - select for diffs
Fri Feb 15 08:54:01 2019 UTC (5 years, 9 months ago) by nonaka
Branches: MAIN
CVS tags: isaki-audio2-base, isaki-audio2
Diff to: previous 1.104: preferred, colored
Changes since revision 1.104: +3 -1 lines
Added Microsoft Hyper-V support.  It ported from OpenBSD and FreeBSD.

graphical console is not work on Gen.2 VM yet. To use the serial console,
enter "consdev com,0x3f8,115200" on efiboot.

Revision 1.104: download - view: text, markup, annotated - select for diffs
Thu Feb 14 08:18:25 2019 UTC (5 years, 10 months ago) by cherry
Branches: MAIN
Diff to: previous 1.103: preferred, colored
Changes since revision 1.103: +9 -6 lines
Welcome XENPVHVM mode.

It is UP only, has xbd(4) and xennet(4) as PV drivers.

The console is com0 at isa and the native portion is very
rudimentary AT architecture, so is probably suboptimal to
run without PV support.

Revision 1.103: download - view: text, markup, annotated - select for diffs
Mon Feb 11 14:59:32 2019 UTC (5 years, 10 months ago) by cherry
Branches: MAIN
Diff to: previous 1.102: preferred, colored
Changes since revision 1.102: +14 -10 lines
We reorganise definitions for XEN source support as follows:

XEN - common sources required for baseline XEN support.
XENPV - sources required for support of XEN in PV mode.
XENPVHVM - sources required for support for XEN in HVM mode.
XENPVH - sources required for support for XEN in PVH mode.

Revision 1.102: download - view: text, markup, annotated - select for diffs
Sat Feb 2 12:32:55 2019 UTC (5 years, 10 months ago) by cherry
Branches: MAIN
Diff to: previous 1.101: preferred, colored
Changes since revision 1.101: +3 -3 lines
Switch NetBSD/xen to use XEN api tag RELEASE-4.11.1

The headers for this api are in sys/external/mit/xen-include-public/dist/

Revision 1.89.2.7: download - view: text, markup, annotated - select for diffs
Wed Dec 26 14:01:45 2018 UTC (5 years, 11 months ago) by pgoyette
Branches: pgoyette-compat
CVS tags: pgoyette-compat-merge-20190127
Diff to: previous 1.89.2.6: preferred, colored; branchpoint 1.89: preferred, colored; next MAIN 1.90: preferred, colored
Changes since revision 1.89.2.6: +8 -3 lines
Sync with HEAD, resolve a few conflicts

Revision 1.101: download - view: text, markup, annotated - select for diffs
Tue Dec 25 06:50:11 2018 UTC (5 years, 11 months ago) by cherry
Branches: MAIN
CVS tags: pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226
Diff to: previous 1.100: preferred, colored
Changes since revision 1.100: +8 -3 lines
Excise XEN specific code out of x86/x86/intr.c into xen/x86/xen_intr.c

While at it, separate the source function tracking so that the interrupt
paths are truly independant.

Use weak symbol exporting to provision for future PVHVM co-existence
of both files, but with independant paths. Introduce assembler code
such that in a unified scenario, native interrupts get first priority
in spllower(), followed by XEN event callbacks. IPL management and
semantics are unchanged - native handlers and xen callbacks are
expected to maintain their ipl related semantics.

In summary, after this commit, native and XEN now have completely
unrelated interrupt handling mechanisms, including
intr_establish_xname() and assembler stubs and intr handler
management.

Happy Christmas!

Revision 1.89.2.6: download - view: text, markup, annotated - select for diffs
Mon Nov 26 01:52:28 2018 UTC (6 years ago) by pgoyette
Branches: pgoyette-compat
Diff to: previous 1.89.2.5: preferred, colored; branchpoint 1.89: preferred, colored
Changes since revision 1.89.2.5: +17 -10 lines
Sync with HEAD, resolve a couple of conflicts

Revision 1.100: download - view: text, markup, annotated - select for diffs
Sun Nov 18 23:50:48 2018 UTC (6 years ago) by cherry
Branches: MAIN
CVS tags: pgoyette-compat-1126
Diff to: previous 1.99: preferred, colored
Changes since revision 1.99: +3 -2 lines
On Xen, copy just the bits we need from the trapframe for hardclock(9)
and statclock(9).

Current, the macros that use the trapframe are:
CLKF_USERMODE()
CLKF_PC()
CLKF_INTR()

Of these, CLKF_INTR() already ignores the frame and uses the ci_idepth
variable to do its job.

Convert the two remaining ones to do this, but only for XEN.

Revision 1.99: download - view: text, markup, annotated - select for diffs
Sun Nov 18 10:24:09 2018 UTC (6 years ago) by cherry
Branches: MAIN
Diff to: previous 1.98: preferred, colored
Changes since revision 1.98: +16 -10 lines
Save the interrupt trap/clockframe to a per-cpu copy.

We can use this copy to pass on the trapframe to hardclock(9) from
within the xen timer handler. This delinks the current dependency
between MD code and the handler, which is specially prototyped to take
the clockframe unlike any other handler.

This change has performance implications, as each interrupt entry will
copy the entire trapframe over to the per-cpu cached copy. This can be
mitigated by selectively copying just the parts of the clockframe that
are used by hardclock() et. al.

Tested on amd64 XEN domU

Revision 1.89.2.5: download - view: text, markup, annotated - select for diffs
Sat Oct 20 06:58:29 2018 UTC (6 years, 1 month ago) by pgoyette
Branches: pgoyette-compat
Diff to: previous 1.89.2.4: preferred, colored; branchpoint 1.89: preferred, colored
Changes since revision 1.89.2.4: +2 -1 lines
Sync with head

Revision 1.66.4.2: download - view: text, markup, annotated - select for diffs
Tue Oct 9 15:43:38 2018 UTC (6 years, 2 months ago) by snj
Branches: netbsd-7
Diff to: previous 1.66.4.1: preferred, colored; branchpoint 1.66: preferred, colored; next MAIN 1.67: preferred, colored
Changes since revision 1.66.4.1: +2 -2 lines
Pull up following revision(s) (requested by msaitoh in ticket #1636):
	sys/arch/x86/include/cacheinfo.h: 1.23-1.26
	sys/arch/x86/include/cpu.h: 1.70
	sys/arch/x86/include/specialreg.h: 1.91-1.93,1.98,1.100,1.102-1.124,1.126,1.130 via patch
	sys/arch/x86/x86/cpu_topology.c: 1.10
	sys/arch/x86/x86/identcpu.c: 1.56-1.57,1.70 via patch
	usr.sbin/cpuctl/arch/i386.c: 1.71,1.75-1.79,1.81-1.85 via patch
Add some register definitions for x86:
  - Add CLWB bit.
  - Fix a few (unused) MSR values, and add some bit definitions of
    MSR_EFER from Murray Armfield in PR#42861.
  - CPUID_CFLUSH bit is not for CFLUSH insn but CLFLUSH insn, so modify
    comments and snprintb() string.
  - Define CPUID Fn00000001 %ebx bits and use them.
    No functional change.
  - Add Structured Extended Flags Enumeration Leaf's bit definitions:
    AVX512_{IFMA,VBMI2,VNNI,BITALG,VPOPCNTDQ,4VNNIW,4FMAPS},GFNI&VAES.
  - Add Turbo Boost Max Technology 3.0 bit.
  - Add AMD SVM features definitions.
  - Add Intel cpuid 7 %edx IBRS and STIBP bit definitions.
  - Fix swapped comments for EFER LME and LMA
  - Add Intel cpuid 7 %edx bit 29 IA32_ARCH_CAPABILITIES supported bit.
  - Add MSR_IA32_ARCH_CAPABILITIES definition.
  - Add IA32_SPEC_CTRL MSR and IA32_PRED_CMD MSR.
  - Add Intel Deterministic Address Translation Parameter Leaf(0x18)
    definitions.
  - s/CLFUSH/CLFLUSH/
  - Add AMD's Disable Indirect Branch Predictor bit definition.
  - Add the MSR bits definitions for IBRS, STIBP and IBPB.
  - Add Intel Fn0000_0006 %eax new bit 14-20 (HWP stuff).
  - Intel Fn0000_0007 %ecx bit 22 is for both RDPID and IA32_TSC_AUX.
  - Add AMD's CPUID Fn80000001 %edx MMX and FXSR bit definitions.
  - Add RDCL_NO and IBRS_ALL.
  - Add SSBD and RSBA bit definitions.
  - Add AMD's SSB bit definitions for F15H, F16H and F17H.
  - Add cpuid 7 edx L1D_FLUSH bit.
  - Add IA32_ARCH_SKIP_L1DFL_VMENTRY bit.
  - Add IA32_FLUSH_CMD MSR.
  - Add yet another Shared L2 TLB (2M/4M pages).
  - Add 3way and 6way of L2 cache or TLB on AMD CPU.
  - AMD L3 cache association bitfield is not 8bit but 4bit like others
    association bitfields.
  - Sort entries. No functional change.
  - Modify comment, fix typo in comment and add comment.
cpuctl(8):
  - Add detection for Quark X1000, Xeon E5 v4, E7 v4,
    Core i7-69xx Extreme Edition, Xeon Scalable (Skylake),
    Xeon Phi [357]200 (Knights Landing), Atom (Goldmont),
    Atom (Denverton), Future Core (Cannon Lake), Atom (Goldmont Plus),
    Xeon Phi 7215, 7285 and 7295 (Knights Mill) and
    7th or 8th gen Core (Kaby Lake, Coffee Lake).
  - Print Structured Extended Feature leaf Fn0000_0007 %ebx on AMD,too.
  - Print Fn0000_0007 %ecx on Intel.
  - Print Intel cpuid 7 %edx.
  - Parse the TLB info from `cpuid leaf 18H' on Intel processor.
  - Use aprint_error_dev() for error output.

Revision 1.98: download - view: text, markup, annotated - select for diffs
Fri Oct 5 18:51:52 2018 UTC (6 years, 2 months ago) by maxv
Branches: MAIN
CVS tags: pgoyette-compat-1020
Diff to: previous 1.97: preferred, colored
Changes since revision 1.97: +2 -1 lines
export x86_fpu_mxcsr_mask, fpu_area_save and fpu_area_restore

Revision 1.89.2.4: download - view: text, markup, annotated - select for diffs
Thu Sep 6 06:55:44 2018 UTC (6 years, 3 months ago) by pgoyette
Branches: pgoyette-compat
Diff to: previous 1.89.2.3: preferred, colored; branchpoint 1.89: preferred, colored
Changes since revision 1.89.2.3: +1 -3 lines
Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)

Revision 1.97: download - view: text, markup, annotated - select for diffs
Wed Aug 22 01:05:23 2018 UTC (6 years, 3 months ago) by msaitoh
Branches: MAIN
CVS tags: pgoyette-compat-0930, pgoyette-compat-0906
Diff to: previous 1.96: preferred, colored
Changes since revision 1.96: +1 -3 lines
- Cleanup for dynamic sysctl:
  - Remove unused *_NAMES macros for sysctl.
  - Remove unused *_MAXID for sysctls.
- Move CTL_MACHDEP sysctl definitions for m68k into m68k/include/cpu.h and
  use them on all m68k machines.

Revision 1.89.2.3: download - view: text, markup, annotated - select for diffs
Sat Jul 28 04:37:42 2018 UTC (6 years, 4 months ago) by pgoyette
Branches: pgoyette-compat
Diff to: previous 1.89.2.2: preferred, colored; branchpoint 1.89: preferred, colored
Changes since revision 1.89.2.2: +77 -54 lines
Sync with HEAD

Revision 1.96: download - view: text, markup, annotated - select for diffs
Mon Jul 16 07:07:30 2018 UTC (6 years, 5 months ago) by pgoyette
Branches: MAIN
CVS tags: pgoyette-compat-0728
Diff to: previous 1.95: preferred, colored
Changes since revision 1.95: +49 -55 lines
More rearrangement of struct cpu_info to keep all the un-conditional
members at fixed locations.

Should address my PR kern/52919

OK maxv@

XXX kernel version bump coming momentarily.

Revision 1.95: download - view: text, markup, annotated - select for diffs
Sun Jul 15 08:47:43 2018 UTC (6 years, 5 months ago) by maxv
Branches: MAIN
Diff to: previous 1.94: preferred, colored
Changes since revision 1.94: +11 -11 lines
Hum. Move the __HAVE_DIRECT_MAP block a little below, otherwise dynamically
loaded kernel modules use a wrong offset for some ci_* fields. Found when
modloading tprof_amd on an AMD 10h, the read of ci_signature was at a
wrong address, and the cpu family was not detected correctly.

Revision 1.94: download - view: text, markup, annotated - select for diffs
Sat Jun 30 14:21:19 2018 UTC (6 years, 5 months ago) by riastradh
Branches: MAIN
Diff to: previous 1.93: preferred, colored
Changes since revision 1.93: +4 -1 lines
Just use struct cpu_info members for the Xen clock state.

Silly to use percpu(9) for some things and struct cpu_info for
others.

Revision 1.93: download - view: text, markup, annotated - select for diffs
Fri Jun 29 21:53:12 2018 UTC (6 years, 5 months ago) by riastradh
Branches: MAIN
Diff to: previous 1.92: preferred, colored
Changes since revision 1.92: +27 -1 lines
Rewrite Xen timecounter and hardclock timer.

With this change, the Xen timecounter should now be globally
monotonic, as every timecounter is supposed to be.  Should also fix a
litany of races in the timecounter logic.

Proposed last year; see mailing list for further details:
https://mail-index.netbsd.org/port-xen/2017/10/31/msg009112.html

ok cherry

Revision 1.89.2.2: download - view: text, markup, annotated - select for diffs
Mon Jun 25 07:25:47 2018 UTC (6 years, 5 months ago) by pgoyette
Branches: pgoyette-compat
Diff to: previous 1.89.2.1: preferred, colored; branchpoint 1.89: preferred, colored
Changes since revision 1.89.2.1: +2 -1 lines
Sync with HEAD

Revision 1.71.2.7: download - view: text, markup, annotated - select for diffs
Sat Jun 23 11:39:02 2018 UTC (6 years, 5 months ago) by martin
Branches: netbsd-8
CVS tags: netbsd-8-0-RELEASE, netbsd-8-0-RC2
Diff to: previous 1.71.2.6: preferred, colored; branchpoint 1.71: preferred, colored
Changes since revision 1.71.2.6: +2 -1 lines
Pull up the following, via patch, requested by maxv in ticket #897:

	sys/arch/amd64/amd64/locore.S           1.166 (patch)
	sys/arch/i386/i386/locore.S             1.157 (patch)
	sys/arch/x86/include/cpu.h              1.92 (patch)
	sys/arch/x86/include/fpu.h              1.9 (patch)
	sys/arch/x86/x86/fpu.c                  1.33-1.39 (patch)
	sys/arch/x86/x86/identcpu.c             1.72 (patch)
	sys/arch/x86/x86/vm_machdep.c           1.34 (patch)
	sys/arch/x86/x86/x86_machdep.c          1.116,1.117 (patch)

Support eager fpu switch, to work around INTEL-SA-00145.
Provide a sysctl machdep.fpu_eager, which gets automatically
initialized to 1 on affected CPUs.

Revision 1.92: download - view: text, markup, annotated - select for diffs
Thu Jun 14 14:36:46 2018 UTC (6 years, 6 months ago) by maxv
Branches: MAIN
CVS tags: phil-wifi-base, pgoyette-compat-0625
Branch point for: phil-wifi
Diff to: previous 1.91: preferred, colored
Changes since revision 1.91: +2 -1 lines
Add some code to support eager fpu switch, INTEL-SA-00145. We restore the
FPU state of the lwp right away during context switches. This guarantees
that when the CPU executes in userland, the FPU doesn't contain secrets.

Maybe we also need to clear the FPU in setregs(), not sure about this one.

Can be enabled/disabled via:

	machdep.fpu_eager = {0/1}

Not yet turned on automatically on affected CPUs (Intel Family 6).

More generally it would be good to turn it on automatically when XSAVEOPT
is supported, because in this case there is probably a non-negligible
performance gain; but we need to fix PR/52966.

Revision 1.71.2.6: download - view: text, markup, annotated - select for diffs
Sat Jun 9 15:12:21 2018 UTC (6 years, 6 months ago) by martin
Branches: netbsd-8
Diff to: previous 1.71.2.5: preferred, colored; branchpoint 1.71: preferred, colored
Changes since revision 1.71.2.5: +2 -1 lines
Pullup the following revisions, requested by maxv in ticket #865:

	sys/arch/amd64/amd64/machdep.c		1.303 (patch)
	sys/arch/amd64/conf/GENERIC		1.492 (patch)
	sys/arch/amd64/conf/files.amd64		1.103 (patch)
	sys/arch/i386/i386/machdep.c		1.806 (patch)
	sys/arch/i386/conf/GENERIC		1.1179 (patch)
	sys/arch/i386/conf/files.i386		1.393 (patch)
	sys/arch/x86/include/cpu.h		1.91 (patch)
	sys/arch/x86/include/specialreg.h	upto 1.126 (patch)
	sys/arch/x86/x86/x86_machdep.c		upto 1.115 (patch, adapted)
	sys/arch/x86/x86/spectre.c		upto 1.19 (patch, adapted,
						no IBRS,
						SpectreV2 mitigations not
						enabled	by default)

Backport the hardware SpectreV2 and SpectreV4 mitigations.

Revision 1.89.2.1: download - view: text, markup, annotated - select for diffs
Sat Apr 7 04:12:14 2018 UTC (6 years, 8 months ago) by pgoyette
Branches: pgoyette-compat
Diff to: previous 1.89: preferred, colored
Changes since revision 1.89: +4 -2 lines
Sync with HEAD.  77 conflicts resolved - all of them $NetBSD$

Revision 1.91: download - view: text, markup, annotated - select for diffs
Wed Apr 4 12:59:49 2018 UTC (6 years, 8 months ago) by maxv
Branches: MAIN
CVS tags: pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407
Diff to: previous 1.90: preferred, colored
Changes since revision 1.90: +2 -1 lines
Enable the SpectreV2 mitigation by default at boot time.

Revision 1.71.2.5: download - view: text, markup, annotated - select for diffs
Sun Apr 1 08:51:47 2018 UTC (6 years, 8 months ago) by martin
Branches: netbsd-8
CVS tags: netbsd-8-0-RC1
Diff to: previous 1.71.2.4: preferred, colored; branchpoint 1.71: preferred, colored
Changes since revision 1.71.2.4: +3 -2 lines
Pull up following revision(s) (requested by maxv in ticket #681):
	sys/arch/x86/include/cpu.h: revision 1.90
	sys/arch/x86/x86/identcpu.c: revision 1.71
Retrieve cpuid.7:%edx.

Revision 1.90: download - view: text, markup, annotated - select for diffs
Fri Mar 30 19:51:53 2018 UTC (6 years, 8 months ago) by maxv
Branches: MAIN
Diff to: previous 1.89: preferred, colored
Changes since revision 1.89: +3 -2 lines
Retrieve cpuid.7:%edx.

Revision 1.71.2.4: download - view: text, markup, annotated - select for diffs
Thu Mar 22 16:59:04 2018 UTC (6 years, 8 months ago) by martin
Branches: netbsd-8
Diff to: previous 1.71.2.3: preferred, colored; branchpoint 1.71: preferred, colored
Changes since revision 1.71.2.3: +15 -1 lines
Pull up the following revisions, requested by maxv in ticket #652:

	sys/arch/amd64/amd64/amd64_trap.S	upto 1.39 (partial, patch)
	sys/arch/amd64/amd64/db_machdep.c	1.6 (patch)
	sys/arch/amd64/amd64/genassym.cf	1.65,1.66,1.67 (patch)
	sys/arch/amd64/amd64/locore.S		upto 1.159 (partial, patch)
	sys/arch/amd64/amd64/machdep.c		1.299-1.302 (patch)
	sys/arch/amd64/amd64/trap.c		upto 1.113 (partial, patch)
	sys/arch/amd64/amd64/amd64/vector.S	upto 1.61 (partial, patch)
	sys/arch/amd64/conf/GENERIC		1.477,1.478 (patch)
	sys/arch/amd64/conf/kern.ldscript	1.26 (patch)
	sys/arch/amd64/include/frameasm.h	upto 1.37 (partial, patch)
	sys/arch/amd64/include/param.h		1.25 (patch)
	sys/arch/amd64/include/pmap.h		1.41,1.43,1.44 (patch)
	sys/arch/x86/conf/files.x86		1.91,1.93 (patch)
	sys/arch/x86/include/cpu.h		1.88,1.89 (patch)
	sys/arch/x86/include/pmap.h		1.75 (patch)
	sys/arch/x86/x86/cpu.c			1.144,1.146,1.148,1.149 (patch)
	sys/arch/x86/x86/pmap.c			upto 1.289 (partial, patch)
	sys/arch/x86/x86/vm_machdep.c		1.31,1.32 (patch)
	sys/arch/x86/x86/x86_machdep.c		1.104,1.106,1.108 (patch)
	sys/arch/x86/x86/svs.c			1.1-1.14
	sys/arch/xen/conf/files.compat		1.30 (patch)

Backport SVS. Not enabled yet.

Revision 1.66.8.1: download - view: text, markup, annotated - select for diffs
Mon Mar 19 16:54:58 2018 UTC (6 years, 8 months ago) by martin
Branches: netbsd-7-0
Diff to: previous 1.66: preferred, colored; next MAIN 1.67: preferred, colored
Changes since revision 1.66: +4 -2 lines
Pull up following revision(s) (requested by msaitoh in ticket #1118):
	sys/arch/x86/include/cpuvar.h: revision 1.47
	sys/arch/x86/x86/cpu.c: revision 1.117
	sys/arch/x86/x86/identcpu.c: revision 1.49
	sys/arch/x86/include/cpu.h: revision 1.67

Retrieve cpuid7 (Structured Extended Features) into ci_feat_val.

Revision 1.71.2.3: download - view: text, markup, annotated - select for diffs
Fri Mar 16 13:17:56 2018 UTC (6 years, 9 months ago) by martin
Branches: netbsd-8
Diff to: previous 1.71.2.2: preferred, colored; branchpoint 1.71: preferred, colored
Changes since revision 1.71.2.2: +3 -1 lines
Pull up the following revisions (via patch), requested by maxv in #635:

	sys/arch/amd64/amd64/gdt.c		1.39-1.45 (patch)
	sys/arch/amd64/amd64/amd64/machdep.c	1.284,1.287,1.288 (patch)
	sys/arch/amd64/amd64/include/param.h	1.23 (patch)
	sys/arch/amd64/include/types.h		1.53 (patch)
	sys/arch/x86/include/cpu.h		1.87 (patch)
	sys/arch/x86/include/pmap.h		1.73,1.74 (patch)
	sys/arch/x86/x86/cpu.c			1.142 (patch)
	sys/arch/x86/x86/intr.c			1.117 (partial),1.120 (patch)
	sys/arch/x86/x86/pmap.c			1.276 (patch)

Initialize ist0 in cpu_init_tss.
Backport __HAVE_PCPU_AREA.

Revision 1.71.2.2: download - view: text, markup, annotated - select for diffs
Tue Mar 13 15:47:45 2018 UTC (6 years, 9 months ago) by martin
Branches: netbsd-8
Diff to: previous 1.71.2.1: preferred, colored; branchpoint 1.71: preferred, colored
Changes since revision 1.71.2.1: +15 -10 lines
Pullup the following revisions via patch, requested by maxv in ticket #629:

	sys/arch/amd64/amd64/genassym.cf		1.63,1.64
	sys/arch/amd64/amd64/locore.S			1.144
	sys/arch/amd64/amd64/machdep.c			1.281-1.283
	sys/arch/i386/i386/genassym.cf			1.105-1.106
	sys/arch/i386/i386/locore.S			1.155
	sys/arch/i386/i386/machdep.c			1.802 (adapted),1.803
	sys/arch/x86/include/cpu.h			1.85
	sys/arch/x86/x86/intr.c				1.115-1.116
	sys/arch/x86/x86/pmap.c				1.275
	sys/arch/x86/x86/sys_machdep.c			1.45
	sys/arch/xen/x86/cpu.c				1.117

Stop sharing the double-fault stack.
Merge the TSS structures into one single cpu_tss structure, and
allocate it dynamically.

Revision 1.71.2.1: download - view: text, markup, annotated - select for diffs
Thu Mar 8 11:33:15 2018 UTC (6 years, 9 months ago) by martin
Branches: netbsd-8
Diff to: previous 1.71: preferred, colored
Changes since revision 1.71: +5 -5 lines
Pull up following revision(s) (requested by maxv in ticket #611):
	sys/arch/x86/x86/cpu.c: revision 1.134 (patch)
	sys/arch/x86/include/cpu.h: revision 1.78 (patch)
	sys/arch/i386/i386/machdep.c: revision 1.792 (patch)

style, and move some i386-specific code into i386/

Revision 1.89: download - view: text, markup, annotated - select for diffs
Thu Jan 18 07:25:34 2018 UTC (6 years, 10 months ago) by maxv
Branches: MAIN
CVS tags: pgoyette-compat-base, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315
Branch point for: pgoyette-compat
Diff to: previous 1.88: preferred, colored
Changes since revision 1.88: +6 -1 lines
Unmap the kernel heap from the user page tables (SVS).

This implementation is optimized and organized in such a way that we
don't need to copy the kernel stack to a safe place during user<->kernel
transitions. We create two VAs that point to the same physical page; one
will be mapped in userland and is offset in order to contain only the
trapframe, the other is mapped in the kernel and maps the entire stack.

Sent on tech-kern@ a week ago.

Revision 1.88: download - view: text, markup, annotated - select for diffs
Sun Jan 7 16:10:16 2018 UTC (6 years, 11 months ago) by maxv
Branches: MAIN
Diff to: previous 1.87: preferred, colored
Changes since revision 1.87: +10 -1 lines
Add a new option, SVS (for Separate Virtual Space), that unmaps kernel
pages when running in userland. For now, only the PTE area is unmapped.

Sent on tech-kern@.

Revision 1.87: download - view: text, markup, annotated - select for diffs
Fri Jan 5 08:04:21 2018 UTC (6 years, 11 months ago) by maxv
Branches: MAIN
Diff to: previous 1.86: preferred, colored
Changes since revision 1.86: +3 -1 lines
Add a __HAVE_PCPU_AREA option, enabled by default on native amd64 but not
Xen.

With this option, the CPU structures that must always be present in the
CPU's page tables are moved on L4 slot 384, which means address
0xffffc00000000000.

A new pcpu_area structure is defined. It contains shared structures (IDT,
LDT), and then an array of pcpu_entry structures, indexed by cpu_index(ci).
Theoretically the LDT should be in the array, but this will be done later.

During the boot procedure, cpu0 calls pmap_init_pcpu, which creates a
page tree that is able to map the pcpu_area structure entirely. cpu0 then
immediately maps the shared structures. Later, every CPU goes through
cpu_pcpuarea_init, which allocates physical pages and kenters the relevant
pcpu_entry to them. Finally, each pointer is replaced to point to pcpuarea.

The point of this change is to make sure that the structures that must
always be present in the page tables have their own L4 slot. Until now
their L4 slot was that of pmap_kernel, and making a distinction between
what must be mapped and what does not need to be was complicated.

Even in the non-speculative-bug case this change makes some sense: there
are several x86 instructions that leak the addresses of the CPU structures,
and putting these structures inside pmap_kernel actually offered a way to
compute the address of the kernel heap - which would have made ASLR on it
plainly useless, had we implemented that.

Note that, for now, pcpuarea does not contain rsp0.

Unfortunately this change adds many #ifdefs, and makes the code harder to
understand. There is also some duplication, but that will be solved later.

Revision 1.86: download - view: text, markup, annotated - select for diffs
Thu Jan 4 13:36:30 2018 UTC (6 years, 11 months ago) by maxv
Branches: MAIN
Diff to: previous 1.85: preferred, colored
Changes since revision 1.85: +2 -2 lines
Allocate the TSS area dynamically. This way cpu_info and cpu_tss can be
put in separate pages.

Revision 1.85: download - view: text, markup, annotated - select for diffs
Thu Jan 4 12:34:15 2018 UTC (6 years, 11 months ago) by maxv
Branches: MAIN
Diff to: previous 1.84: preferred, colored
Changes since revision 1.84: +15 -10 lines
Group the different TSSes into a cpu_tss structure. And pack this
structure to make sure there is no padding between 'tss' and 'iomap'.

Revision 1.84: download - view: text, markup, annotated - select for diffs
Thu Dec 28 08:30:36 2017 UTC (6 years, 11 months ago) by maxv
Branches: MAIN
Diff to: previous 1.83: preferred, colored
Changes since revision 1.83: +5 -5 lines
typos

Revision 1.52.2.3: download - view: text, markup, annotated - select for diffs
Sun Dec 3 11:36:50 2017 UTC (7 years ago) by jdolecek
Branches: tls-maxphys
Diff to: previous 1.52.2.2: preferred, colored; next MAIN 1.53: preferred, colored
Changes since revision 1.52.2.2: +49 -33 lines
update from HEAD

Revision 1.83: download - view: text, markup, annotated - select for diffs
Sat Dec 2 21:04:59 2017 UTC (7 years ago) by christos
Branches: MAIN
Diff to: previous 1.82: preferred, colored
Changes since revision 1.82: +3 -1 lines
Add padding to make the 32/64 bit structs the same.

Revision 1.82: download - view: text, markup, annotated - select for diffs
Mon Nov 27 09:10:12 2017 UTC (7 years ago) by maxv
Branches: MAIN
CVS tags: tls-maxphys-base-20171202
Diff to: previous 1.81: preferred, colored
Changes since revision 1.81: +1 -9 lines
Remove unused fields, there is no alignment we need to enforce.

Revision 1.81: download - view: text, markup, annotated - select for diffs
Thu Nov 23 16:30:50 2017 UTC (7 years ago) by kamil
Branches: MAIN
Diff to: previous 1.80: preferred, colored
Changes since revision 1.80: +3 -1 lines
Restore removed sysctl(2) x86 entry: fpu_present

Hardcode it to 1 for now on i386 and amd64.

This unbreaks software that used it (e.g. LLDB).

Removal noted by <christos>

PR lib/52756 by myself

Revision 1.80: download - view: text, markup, annotated - select for diffs
Mon Oct 9 17:49:27 2017 UTC (7 years, 2 months ago) by maya
Branches: MAIN
Diff to: previous 1.79: preferred, colored
Changes since revision 1.79: +1 -3 lines
GC i386_fpu_present. no FPU x86 is not supported.

Also delete newly unused send_sigill

Revision 1.79: download - view: text, markup, annotated - select for diffs
Sat Sep 16 09:28:38 2017 UTC (7 years, 2 months ago) by maxv
Branches: MAIN
Diff to: previous 1.78: preferred, colored
Changes since revision 1.78: +4 -0 lines
Move xpq_idx into cpu_info, to prevent false sharing between CPUs. Saves
10s when doing a './build.sh -j 3 kernel=GENERIC' on xen-amd64-domU.

Revision 1.66.6.2: download - view: text, markup, annotated - select for diffs
Mon Aug 28 17:51:56 2017 UTC (7 years, 3 months ago) by skrll
Branches: nick-nhusb
Diff to: previous 1.66.6.1: preferred, colored; branchpoint 1.66: preferred, colored; next MAIN 1.67: preferred, colored
Changes since revision 1.66.6.1: +39 -18 lines
Sync with HEAD

Revision 1.78: download - view: text, markup, annotated - select for diffs
Sun Aug 27 09:32:13 2017 UTC (7 years, 3 months ago) by maxv
Branches: MAIN
Diff to: previous 1.77: preferred, colored
Changes since revision 1.77: +4 -4 lines
style, and move some i386-specific code into i386/

Revision 1.77: download - view: text, markup, annotated - select for diffs
Sun Aug 27 08:38:32 2017 UTC (7 years, 3 months ago) by maxv
Branches: MAIN
Diff to: previous 1.76: preferred, colored
Changes since revision 1.76: +1 -4 lines
Localify. By the way, we should use a different stack for NMIs.

Revision 1.76: download - view: text, markup, annotated - select for diffs
Sat Aug 12 07:21:57 2017 UTC (7 years, 4 months ago) by maxv
Branches: MAIN
CVS tags: nick-nhusb-base-20170825
Diff to: previous 1.75: preferred, colored
Changes since revision 1.75: +1 -7 lines
Remove vm86.

Pass 3.

Revision 1.75: download - view: text, markup, annotated - select for diffs
Sat Jul 22 09:01:46 2017 UTC (7 years, 4 months ago) by maxv
Branches: MAIN
Diff to: previous 1.74: preferred, colored
Changes since revision 1.74: +1 -5 lines
Call _proc0_tss_ldt_init only once, and rename them.

Revision 1.74.2.2: download - view: text, markup, annotated - select for diffs
Sun Jul 16 14:02:49 2017 UTC (7 years, 5 months ago) by cherry
Branches: perseant-stdc-iso10646
Diff to: previous 1.74.2.1: preferred, colored; branchpoint 1.74: preferred, colored; next MAIN 1.75: preferred, colored
Changes since revision 1.74.2.1: +564 -0 lines
2302677

Revision 1.74.2.1
Sun Jul 16 14:02:48 2017 UTC (7 years, 5 months ago) by cherry
Branches: perseant-stdc-iso10646
FILE REMOVED
Changes since revision 1.74: +0 -564 lines
file cpu.h was added on branch perseant-stdc-iso10646 on 2017-07-16 14:02:49 +0000

Revision 1.74: download - view: text, markup, annotated - select for diffs
Sun Jul 16 14:02:48 2017 UTC (7 years, 5 months ago) by cherry
Branches: MAIN
CVS tags: perseant-stdc-iso10646-base
Branch point for: perseant-stdc-iso10646
Diff to: previous 1.73: preferred, colored
Changes since revision 1.73: +3 -4 lines
Unify the xen and native x86/ interrupt setup functions and
spl traversal data structures.

This is towards PVHVM.

Revision 1.73: download - view: text, markup, annotated - select for diffs
Fri Jun 16 18:17:42 2017 UTC (7 years, 5 months ago) by jdolecek
Branches: MAIN
Diff to: previous 1.72: preferred, colored
Changes since revision 1.72: +1 -3 lines
dumpconf(void) long doesn't exist, remove the prototype

PR kern/39714 by Henning Petersen

Revision 1.72: download - view: text, markup, annotated - select for diffs
Fri Jun 9 01:16:54 2017 UTC (7 years, 6 months ago) by chs
Branches: MAIN
Diff to: previous 1.71: preferred, colored
Changes since revision 1.71: +3 -1 lines
if __HIDE_DELAY is defined, do not define delay() or DELAY().
needed by dtrace and ZFS.

Revision 1.71: download - view: text, markup, annotated - select for diffs
Tue May 23 08:48:34 2017 UTC (7 years, 6 months ago) by nonaka
Branches: MAIN
CVS tags: netbsd-8-base, matt-nb8-mediatek-base, matt-nb8-mediatek
Branch point for: netbsd-8
Diff to: previous 1.70: preferred, colored
Changes since revision 1.70: +13 -1 lines
x86: hypervisor detection from FreeBSD for x2APIC support.

Revision 1.69.2.1: download - view: text, markup, annotated - select for diffs
Fri May 19 00:22:56 2017 UTC (7 years, 6 months ago) by pgoyette
Branches: prg-localcount2
Diff to: previous 1.69: preferred, colored; next MAIN 1.70: preferred, colored
Changes since revision 1.69: +2 -2 lines
Resolve conflicts from previous merge (all resulting from $NetBSD
keywork expansion)

Revision 1.70: download - view: text, markup, annotated - select for diffs
Mon May 15 04:02:52 2017 UTC (7 years, 7 months ago) by msaitoh
Branches: MAIN
CVS tags: prg-localcount2-base3
Diff to: previous 1.69: preferred, colored
Changes since revision 1.69: +2 -2 lines
 CPUID_CFLUSH bit is not for CFLUSH insn but CLFLUSH insn, so modify comments
and snprintb() sring.

Revision 1.67.2.2: download - view: text, markup, annotated - select for diffs
Wed Apr 26 02:53:09 2017 UTC (7 years, 7 months ago) by pgoyette
Branches: pgoyette-localcount
Diff to: previous 1.67.2.1: preferred, colored; branchpoint 1.67: preferred, colored; next MAIN 1.68: preferred, colored
Changes since revision 1.67.2.1: +12 -2 lines
Sync with HEAD

Revision 1.67.4.1: download - view: text, markup, annotated - select for diffs
Fri Apr 21 16:53:39 2017 UTC (7 years, 7 months ago) by bouyer
Branches: bouyer-socketcan
Diff to: previous 1.67: preferred, colored; next MAIN 1.68: preferred, colored
Changes since revision 1.67: +22 -2 lines
Sync with HEAD

Revision 1.69: download - view: text, markup, annotated - select for diffs
Fri Apr 14 04:43:47 2017 UTC (7 years, 8 months ago) by kamil
Branches: MAIN
CVS tags: prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, pgoyette-localcount-20170426, bouyer-socketcan-base1
Branch point for: prg-localcount2
Diff to: previous 1.68: preferred, colored
Changes since revision 1.68: +12 -2 lines
x86: Export fpu_save, fpu_save_size, xsave_features to dedicated sysctl nodes

Add new defines:
 - CPU_FPU_SAVE (15)
   int: FPU Instructions layout
   * to use this, CPU_OSFXSR must be true
   * 0: FSAVE
   * 1: FXSAVE
   * 2: XSAVE
   * 3: XSAVEOPT
 - CPU_FPU_SAVE_SIZE (16)
   int: FPU Instruction layout size
 - CPU_XSAVE_FEATURES (17)
   quad: FPU XSAVE features

Bump CPU_MAXID from 15 to 18.

These values were prepared originally to be exported without ASCIIZ name to
be used as handler. These values are useful to get FPU accessors in a
debugger easier to implement on x86 (PT_SETFPREG, PT_GETFPREG).

This interface handles all supported x86 targets. In the older (i386) and
less featured CPUs check first osfxsr (OS uses FXSAVE/FXRSTOR).

According to sys/arch/x86/include/cpu.h r.1.65 this was prepared to be
exported beyond simple CTL_CREATE node.

Sponsored by <The NetBSD Foundation>

Revision 1.67.2.1: download - view: text, markup, annotated - select for diffs
Mon Mar 20 06:57:22 2017 UTC (7 years, 8 months ago) by pgoyette
Branches: pgoyette-localcount
Diff to: previous 1.67: preferred, colored
Changes since revision 1.67: +11 -1 lines
Sync with HEAD

Revision 1.68: download - view: text, markup, annotated - select for diffs
Sat Feb 11 14:11:24 2017 UTC (7 years, 10 months ago) by maxv
Branches: MAIN
CVS tags: pgoyette-localcount-20170320, jdolecek-ncq-base, jdolecek-ncq
Diff to: previous 1.67: preferred, colored
Changes since revision 1.67: +11 -1 lines
Instead of using a global array with per-cpu indexes, embed the tmp VAs
into cpu_info directly. This concerns only {i386, Xen-i386, Xen-amd64},
because amd64 already has a direct map that is way faster than that.

There are two major issues with the global array: maxcpus entries are
allocated while it is unlikely that common i386 machines have so many
cpus, and the base VA of these entries is not cache-line-aligned, which
mostly guarantees cache-line-thrashing each time the VAs are entered.

Now the number of tmp VAs allocated is proportionate to the number of CPUs
attached (which therefore reduces memory consumption), and the base is
properly aligned.

On my 3-core AMD, the number of DC_refills_L2 events triggered when
performing 5x10^6 calls to pmap_zero_page on two dedicated cores is on
average divided by two with this patch.

Discussed on tech-kern a little.

Revision 1.66.4.1: download - view: text, markup, annotated - select for diffs
Sun Mar 6 17:53:26 2016 UTC (8 years, 9 months ago) by martin
Branches: netbsd-7
CVS tags: netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1
Diff to: previous 1.66: preferred, colored
Changes since revision 1.66: +4 -2 lines
Pull up following revision(s) (requested by msaitoh in ticket #1118):
	sys/arch/x86/include/cpuvar.h: revision 1.47
	sys/arch/x86/x86/cpu.c: revision 1.117
	sys/arch/x86/x86/identcpu.c: revision 1.49
	sys/arch/x86/include/cpu.h: revision 1.67
Retrieve cpuid7 (Structured Extended Features) into ci_feat_val.

Revision 1.66.6.1: download - view: text, markup, annotated - select for diffs
Sun Dec 27 12:09:45 2015 UTC (8 years, 11 months ago) by skrll
Branches: nick-nhusb
Diff to: previous 1.66: preferred, colored
Changes since revision 1.66: +4 -2 lines
Sync with HEAD (as of 26th Dec)

Revision 1.67: download - view: text, markup, annotated - select for diffs
Sun Dec 13 15:02:19 2015 UTC (9 years ago) by maxv
Branches: MAIN
CVS tags: pgoyette-localcount-base, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, nick-nhusb-base-20170204, nick-nhusb-base-20161204, nick-nhusb-base-20161004, nick-nhusb-base-20160907, nick-nhusb-base-20160529, nick-nhusb-base-20160422, nick-nhusb-base-20160319, nick-nhusb-base-20151226, localcount-20160914, bouyer-socketcan-base
Branch point for: pgoyette-localcount, bouyer-socketcan
Diff to: previous 1.66: preferred, colored
Changes since revision 1.66: +4 -2 lines
Retrieve cpuid7 (Structured Extended Features) into ci_feat_val.

Revision 1.52.2.2: download - view: text, markup, annotated - select for diffs
Wed Aug 20 00:03:29 2014 UTC (10 years, 3 months ago) by tls
Branches: tls-maxphys
Diff to: previous 1.52.2.1: preferred, colored
Changes since revision 1.52.2.1: +35 -18 lines
Rebase to HEAD as of a few days ago.

Revision 1.40.2.5: download - view: text, markup, annotated - select for diffs
Thu May 22 11:40:13 2014 UTC (10 years, 6 months ago) by yamt
Branches: yamt-pagecache
Diff to: previous 1.40.2.4: preferred, colored; branchpoint 1.40: preferred, colored; next MAIN 1.41: preferred, colored
Changes since revision 1.40.2.4: +35 -18 lines
sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")

Revision 1.53.2.1: download - view: text, markup, annotated - select for diffs
Sun May 18 17:45:30 2014 UTC (10 years, 6 months ago) by rmind
Branches: rmind-smpnet
Diff to: previous 1.53: preferred, colored; next MAIN 1.54: preferred, colored
Changes since revision 1.53: +35 -18 lines
sync with head

Revision 1.66: download - view: text, markup, annotated - select for diffs
Sun Feb 23 22:38:40 2014 UTC (10 years, 9 months ago) by dsl
Branches: MAIN
CVS tags: yamt-pagecache-base9, tls-maxphys-base, tls-earlyentropy-base, tls-earlyentropy, rmind-smpnet-nbase, rmind-smpnet-base, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, nick-nhusb-base-20150921, nick-nhusb-base-20150606, nick-nhusb-base-20150406, nick-nhusb-base, netbsd-7-base, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE
Branch point for: nick-nhusb, netbsd-7-0, netbsd-7
Diff to: previous 1.65: preferred, colored
Changes since revision 1.65: +2 -2 lines
Rename (the recently added) 'x86_xsave_size' to 'x86_fpu_save_size'
  and default to 512 (the size of the fxsave structure).

Revision 1.65: download - view: text, markup, annotated - select for diffs
Sun Feb 23 12:56:40 2014 UTC (10 years, 9 months ago) by dsl
Branches: MAIN
Diff to: previous 1.64: preferred, colored
Changes since revision 1.64: +9 -1 lines
Determine whether the cpu supports xsave (and hence AVX).
The result is only written to sysctl nodes at the moment.
I see:
machdep.fpu_save = 3 (implies xsaveopt)
machdep.xsave_size = 832
machdep.xsave_features = 7
Completely common up the i386 and amd64 machdep sysctl creation.

Revision 1.64: download - view: text, markup, annotated - select for diffs
Sat Feb 22 17:48:08 2014 UTC (10 years, 9 months ago) by dsl
Branches: MAIN
Diff to: previous 1.63: preferred, colored
Changes since revision 1.63: +12 -10 lines
Re-use the unused ci_cpu_serial[3] to save the highest cpuid values
  for the normal and extended leafs.
(The 'normal' one might be luring in the global cpulevel.)
Read the 'extended feature' from cpuid.80000001.%ecx/edx into
    ci_feat_val[3/2] just after saving cpuid.1.%ecx/dx in ci_feat_val[1/0]
    instead of doing it separately for amd k678 and via c3 processors
    in their probe functions and repeating it for all cpus a few instructions
    later when x86_cpu_topology() is called.
x86_cpu_topology() is only called from cpu_probe() and really doesn't
  deserve its own source file. Chasing the setup code is bad enough anyway.

Revision 1.63: download - view: text, markup, annotated - select for diffs
Thu Feb 20 18:14:11 2014 UTC (10 years, 9 months ago) by dsl
Branches: MAIN
Diff to: previous 1.62: preferred, colored
Changes since revision 1.62: +2 -1 lines
This needs stdint.h in userspace (for uint64_t)

Revision 1.62: download - view: text, markup, annotated - select for diffs
Sat Feb 15 10:11:15 2014 UTC (10 years, 10 months ago) by dsl
Branches: MAIN
Diff to: previous 1.61: preferred, colored
Changes since revision 1.61: +1 -5 lines
Remove all references to MDL_USEDFPU and deferred fpu initialisation.
The cost of zeroing the save area on exec is minimal.
This stops the FP registers of a random process being used the first
  time an lwp uses the fpu.
sendsig_siginfo() and get_mcontext() now unconditionally copy the FP
registers.
I'll remove the double-copy for signal handlers soon.
get_mcontext() might have been leaking kernel memory to userspace - and
  may still do so if i386_use_fxsave is false (short copies).

Revision 1.61: download - view: text, markup, annotated - select for diffs
Wed Feb 12 23:24:09 2014 UTC (10 years, 10 months ago) by dsl
Branches: MAIN
Diff to: previous 1.60: preferred, colored
Changes since revision 1.60: +13 -3 lines
Change i386 to use x86/fpu.c instead of i386/isa/npx.c
This changes the trap10 and trap13 code to call directly into fpu.c,
  removing all the code for T_ARITHTRAP, T_XMM and T_FPUNDA from i386/trap.c
Not all of the code thate appeared to handle fpu traps was ever called!
Most of the changes just replace the include of machine/npx.h with x86/fpu.h
  (or remove it entirely).

Revision 1.60: download - view: text, markup, annotated - select for diffs
Tue Feb 4 21:09:24 2014 UTC (10 years, 10 months ago) by dsl
Branches: MAIN
Diff to: previous 1.59: preferred, colored
Changes since revision 1.59: +2 -2 lines
There is no need to check for recursive calls into fpudna().
Rename the associated ci_fpsaving field to 'unused'.
I'm not sure they could ever happen, you could get unwanted calls into
  the fpu trap code while saving state when using INT13 - but these are
  different.
The return value from the i386 fpudna() was always 1 - possibly a historic
  relic of the kernel fp emulation. Remove and don't check in trap.S.
The amd64 and i386 fpudna() code is now almost identical.

Revision 1.59: download - view: text, markup, annotated - select for diffs
Sun Jan 26 19:16:17 2014 UTC (10 years, 10 months ago) by dsl
Branches: MAIN
Diff to: previous 1.58: preferred, colored
Changes since revision 1.58: +3 -3 lines
Remove support for 'external' floating point units and the MS-DOS
  compatible method of handling floating point exceptions.
Make kernel support for teh fpu non-optional (486SX should still work).
Only 386 cpus support external fpu, and i386 support was removed years ago.
This means that the npx code no longer uses port 0xf0 or interupt 13.
All the "npx at isa" lines go from the configs, arch/i386/isa/npx.c
  is now mandatory for all i386 kernels.
I've renamed npxinit() to fpuinit() and npxinit_cpu() to fpuinit_cpu()
  to match the very similar amd64 functions.
The fpu of the boot cpu is now initialised by a direct call from
  cpu_configure(), this enables FP emulation for a 486SX.
  (for amd64 the cr0 values are set in locore.S and similar).
This fixes a long-standing bug in linux_setregs() - which did not
  save the fpu regsiters if they were active.
I've test booted a single cpu i386 kernel (using anita).
amd64 builds - none of teh changes should affect it.
The i386 XEN kernels build, but I'm not sure where they set cr0, and
  it might have got lost!

Revision 1.58: download - view: text, markup, annotated - select for diffs
Sun Dec 1 01:05:16 2013 UTC (11 years ago) by christos
Branches: MAIN
Diff to: previous 1.57: preferred, colored
Changes since revision 1.57: +7 -1 lines
revert fpu/pcu changes until we figure out what's wrong; they cause random
freezes

Revision 1.57: download - view: text, markup, annotated - select for diffs
Sun Nov 10 00:50:13 2013 UTC (11 years, 1 month ago) by christos
Branches: MAIN
Diff to: previous 1.56: preferred, colored
Changes since revision 1.56: +3 -4 lines
use __unused instead of __USE and void cast to mark iterator variable unused
where needed (from phone)

Revision 1.56: download - view: text, markup, annotated - select for diffs
Tue Nov 5 16:04:13 2013 UTC (11 years, 1 month ago) by christos
Branches: MAIN
Diff to: previous 1.55: preferred, colored
Changes since revision 1.55: +3 -2 lines
initialize cii before using it.

Revision 1.55: download - view: text, markup, annotated - select for diffs
Wed Oct 23 20:18:50 2013 UTC (11 years, 1 month ago) by drochner
Branches: MAIN
Diff to: previous 1.54: preferred, colored
Changes since revision 1.54: +1 -7 lines
Use the MI "pcu" framework for bookkeeping of npx/fpu states on x86.
This reduces the amount of MD code enormously, and makes it easier
to implement support for newer CPU features which require more fpu
state, or for fpu usage by the kernel.
For access to FPU state across CPUs, an xcall kthread is used now
rather than a dedicated IPI.
No user visible changes intended.

Revision 1.54: download - view: text, markup, annotated - select for diffs
Thu Oct 17 20:59:16 2013 UTC (11 years, 1 month ago) by christos
Branches: MAIN
Diff to: previous 1.53: preferred, colored
Changes since revision 1.53: +2 -2 lines
__USE() unused variables

Revision 1.52.2.1: download - view: text, markup, annotated - select for diffs
Tue Nov 20 03:01:51 2012 UTC (12 years ago) by tls
Branches: tls-maxphys
Diff to: previous 1.52: preferred, colored
Changes since revision 1.52: +1 -2 lines
Resync to 2012-11-19 00:00:00 UTC

Revision 1.40.2.4: download - view: text, markup, annotated - select for diffs
Tue Oct 30 17:20:32 2012 UTC (12 years, 1 month ago) by yamt
Branches: yamt-pagecache
CVS tags: yamt-pagecache-tag8
Diff to: previous 1.40.2.3: preferred, colored; branchpoint 1.40: preferred, colored
Changes since revision 1.40.2.3: +2 -4 lines
sync with head

Revision 1.53: download - view: text, markup, annotated - select for diffs
Sat Oct 27 17:18:13 2012 UTC (12 years, 1 month ago) by chs
Branches: MAIN
CVS tags: yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, khorben-n900, agc-symver-base, agc-symver
Branch point for: rmind-smpnet
Diff to: previous 1.52: preferred, colored
Changes since revision 1.52: +1 -2 lines
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.

Revision 1.52: download - view: text, markup, annotated - select for diffs
Sun Jul 15 15:17:56 2012 UTC (12 years, 5 months ago) by dsl
Branches: MAIN
Branch point for: tls-maxphys
Diff to: previous 1.51: preferred, colored
Changes since revision 1.51: +1 -2 lines
Rename MDP_IRET to MDL_IRET since it is an lwp flag, not a proc one.
Add an MDL_COMPAT32 flag to the lwp's md_flags, set it for 32bit lwps
  and use it to force 'return to user' with iret (as is done when
  MDL_IRET is set).
Split the iret/sysret code paths much later.
Remove all the replicated code for 32bit system calls - which was only
  needed so that iret was always used.
frameasm.h for XEN contains '#define swapgs', while XEN probable never
  needs swapgs, this is likely to be confusing.
Add a SWAPGS which is a nop on XEN and swapgs otherwise.
(I've not yet checked all the swapgs in files that include frameasm.h)
Simple x86 programs still work.
Hijack 6.99.9 kernel bump (needed for compat32 modules)

Revision 1.51: download - view: text, markup, annotated - select for diffs
Sat Jun 16 17:30:18 2012 UTC (12 years, 6 months ago) by chs
Branches: MAIN
Diff to: previous 1.50: preferred, colored
Changes since revision 1.50: +2 -2 lines
rename the global variable "cpu" to "cputype" to avoid conflicting with
dtrace, which wants to use "cpu" as a local variable.

Revision 1.40.2.3: download - view: text, markup, annotated - select for diffs
Wed May 23 10:07:51 2012 UTC (12 years, 6 months ago) by yamt
Branches: yamt-pagecache
Diff to: previous 1.40.2.2: preferred, colored; branchpoint 1.40: preferred, colored
Changes since revision 1.40.2.2: +2 -4 lines
sync with head.

Revision 1.47.2.3: download - view: text, markup, annotated - select for diffs
Wed May 9 03:22:52 2012 UTC (12 years, 7 months ago) by riz
Branches: netbsd-6
CVS tags: netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus
Diff to: previous 1.47.2.2: preferred, colored; branchpoint 1.47: preferred, colored; next MAIN 1.48: preferred, colored
Changes since revision 1.47.2.2: +2 -4 lines
Pull up following revision(s) (requested by rmind in ticket #202):
	sys/arch/x86/include/cpuvar.h: revision 1.46
	sys/arch/xen/include/xenpmap.h: revision 1.34
	sys/arch/i386/include/param.h: revision 1.77
	sys/arch/x86/x86/pmap_tlb.c: revision 1.5
	sys/arch/x86/x86/pmap_tlb.c: revision 1.6
	sys/arch/i386/i386/genassym.cf: revision 1.92
	sys/arch/xen/x86/cpu.c: revision 1.91
	sys/arch/x86/x86/pmap.c: revision 1.177
	sys/arch/xen/x86/xen_pmap.c: revision 1.21
	sys/arch/x86/acpi/acpi_wakeup.c: revision 1.31
	sys/kern/subr_kcpuset.c: revision 1.5
	sys/arch/amd64/include/param.h: revision 1.18
	sys/sys/kcpuset.h: revision 1.5
	sys/arch/x86/x86/mtrr_i686.c: revision 1.26
	sys/arch/x86/x86/mtrr_i686.c: revision 1.27
	sys/arch/xen/x86/x86_xpmap.c: revision 1.43
	sys/arch/x86/x86/cpu.c: revision 1.98
	sys/arch/amd64/amd64/mptramp.S: revision 1.14
	sys/kern/sys_sched.c: revision 1.42
	sys/arch/amd64/amd64/genassym.cf: revision 1.50
	sys/arch/i386/i386/mptramp.S: revision 1.24
	sys/arch/x86/include/pmap.h: revision 1.52
	sys/arch/x86/include/cpu.h: revision 1.50
- Convert x86 MD code, mainly pmap(9) e.g. TLB shootdown code, to use
  kcpuset(9) and thus replace hardcoded CPU bitmasks.  This removes the
  limitation of maximum CPUs.
- Support up to 256 CPUs on amd64 architecture by default.
Bug fixes, improvements, completion of Xen part and testing on 64-core
AMD Opteron(tm) Processor 6282 SE (also, as Xen HVM domU with 128 CPUs)
by Manuel Bouyer.
- pmap_tlb_shootdown: do not overwrite tp_cpumask with pm_cpus, but merge
  like pm_kernel_cpus.  Remove unecessary intersection with kcpuset_running.
  Do not reset tp_userpmap if pmap_kernel().
- Remove pmap_tlb_mailbox_t wrapping, which is pointless after recent changes.
- pmap_tlb_invalidate, pmap_tlb_intr: constify for packet structure.
i686_mtrr_init_first: handle the case when there are no variable-size MTRR
registers available (i686_mtrr_vcnt == 0).

Revision 1.43.4.5: download - view: text, markup, annotated - select for diffs
Sun Apr 29 23:04:43 2012 UTC (12 years, 7 months ago) by mrg
Branches: jmcneill-usbmp
Diff to: previous 1.43.4.4: preferred, colored; branchpoint 1.43: preferred, colored; next MAIN 1.44: preferred, colored
Changes since revision 1.43.4.4: +2 -4 lines
sync to latest -current.

Revision 1.50: download - view: text, markup, annotated - select for diffs
Fri Apr 20 22:23:24 2012 UTC (12 years, 7 months ago) by rmind
Branches: MAIN
CVS tags: yamt-pagecache-base5, jmcneill-usbmp-base9, jmcneill-usbmp-base10
Diff to: previous 1.49: preferred, colored
Changes since revision 1.49: +2 -4 lines
- Convert x86 MD code, mainly pmap(9) e.g. TLB shootdown code, to use
  kcpuset(9) and thus replace hardcoded CPU bitmasks.  This removes the
  limitation of maximum CPUs.

- Support up to 256 CPUs on amd64 architecture by default.

Bug fixes, improvements, completion of Xen part and testing on 64-core
AMD Opteron(tm) Processor 6282 SE (also, as Xen HVM domU with 128 CPUs)
by Manuel Bouyer.

Revision 1.40.2.2: download - view: text, markup, annotated - select for diffs
Tue Apr 17 00:07:05 2012 UTC (12 years, 8 months ago) by yamt
Branches: yamt-pagecache
Diff to: previous 1.40.2.1: preferred, colored; branchpoint 1.40: preferred, colored
Changes since revision 1.40.2.1: +13 -10 lines
sync with head

Revision 1.43.4.4: download - view: text, markup, annotated - select for diffs
Tue Mar 6 18:26:39 2012 UTC (12 years, 9 months ago) by mrg
Branches: jmcneill-usbmp
Diff to: previous 1.43.4.3: preferred, colored; branchpoint 1.43: preferred, colored
Changes since revision 1.43.4.3: +1 -2 lines
sync to -current

Revision 1.43.4.3: download - view: text, markup, annotated - select for diffs
Tue Mar 6 09:56:11 2012 UTC (12 years, 9 months ago) by mrg
Branches: jmcneill-usbmp
Diff to: previous 1.43.4.2: preferred, colored; branchpoint 1.43: preferred, colored
Changes since revision 1.43.4.2: +2 -1 lines
sync to -current

Revision 1.47.2.2: download - view: text, markup, annotated - select for diffs
Mon Mar 5 20:18:02 2012 UTC (12 years, 9 months ago) by sborrill
Branches: netbsd-6
Diff to: previous 1.47.2.1: preferred, colored; branchpoint 1.47: preferred, colored
Changes since revision 1.47.2.1: +1 -2 lines
Pull up the following revisions(s) (requested by bouyer in ticket #80):
	sys/arch/xen/x86/x86_xpmap.c:	revision 1.42
	sys/arch/x86/include/specialreg.h:	revision 1.56
	sys/arch/amd64/amd64/machdep.c:	revision 1.179
	sys/arch/i386/i386/locore.S:	revision 1.97
	sys/arch/i386/i386/machdep.c:	revision 1.723 via patch
	sys/arch/x86/include/cpu.h:	revision 1.49

Fix possible FPU registers corruption on context switches.
Fix type of pointers passed to some hypercalls.

Revision 1.43.4.2: download - view: text, markup, annotated - select for diffs
Sun Mar 4 00:46:15 2012 UTC (12 years, 9 months ago) by mrg
Branches: jmcneill-usbmp
Diff to: previous 1.43.4.1: preferred, colored; branchpoint 1.43: preferred, colored
Changes since revision 1.43.4.1: +1 -2 lines
sync to latest -current.

Revision 1.49: download - view: text, markup, annotated - select for diffs
Fri Mar 2 16:43:31 2012 UTC (12 years, 9 months ago) by bouyer
Branches: MAIN
CVS tags: yamt-pagecache-base4, jmcneill-usbmp-base8, jmcneill-usbmp-base7, jmcneill-usbmp-base6, jmcneill-usbmp-base4
Diff to: previous 1.48: preferred, colored
Changes since revision 1.48: +1 -2 lines
Follow locore.S and move FPU handling from x86_64_switch_context() to
x86_64_tls_switch(); raise IPL to IPL_HIGH in x86_64_switch_context()
and test ci_fpcurlwp to decide to disable FPU or not.
Change the Xen i386 context switch code to be like the amd64 one.

Revision 1.47.2.1: download - view: text, markup, annotated - select for diffs
Wed Feb 22 18:56:47 2012 UTC (12 years, 9 months ago) by riz
Branches: netbsd-6
Diff to: previous 1.47: preferred, colored
Changes since revision 1.47: +4 -2 lines
Pull up following revision(s) (requested by bouyer in ticket #29):
	sys/arch/xen/x86/x86_xpmap.c: revision 1.39
	sys/arch/xen/include/hypervisor.h: revision 1.37
	sys/arch/xen/include/intr.h: revision 1.34
	sys/arch/xen/x86/xen_ipi.c: revision 1.10
	sys/arch/x86/x86/cpu.c: revision 1.97
	sys/arch/x86/include/cpu.h: revision 1.48
	sys/uvm/uvm_map.c: revision 1.315
	sys/arch/x86/x86/pmap.c: revision 1.165
	sys/arch/xen/x86/cpu.c: revision 1.81
	sys/arch/x86/x86/pmap.c: revision 1.167
	sys/arch/xen/x86/cpu.c: revision 1.82
	sys/arch/x86/x86/pmap.c: revision 1.168
	sys/arch/xen/x86/xen_pmap.c: revision 1.17
	sys/uvm/uvm_km.c: revision 1.122
	sys/uvm/uvm_kmguard.c: revision 1.10
	sys/arch/x86/include/pmap.h: revision 1.50
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.
When using uvm_km_pgremove_intrsafe() make sure mappings are removed
before returning the pages to the free pool. Otherwise, under Xen,
a page which still has a writable mapping could be allocated for
a PDP by another CPU and the hypervisor would refuse it (this is
PR port-xen/45975).
For this, move the pmap_kremove() calls inside uvm_km_pgremove_intrsafe(),
and do pmap_kremove()/uvm_pagefree() in batch of (at most) 16 entries
(as suggested by Chuck Silvers on tech-kern@, see also
http://mail-index.netbsd.org/tech-kern/2012/02/17/msg012727.html and
followups).
Avoid early use of xen_kpm_sync(); locks are not available at this time.
Don't call cpu_init() twice.
Makes LOCKDEBUG kernels boot again
Revert pmap_pte_flush() -> xpq_flush_queue() in previous.

Revision 1.43.4.1: download - view: text, markup, annotated - select for diffs
Sat Feb 18 07:33:34 2012 UTC (12 years, 9 months ago) by mrg
Branches: jmcneill-usbmp
Diff to: previous 1.43: preferred, colored
Changes since revision 1.43: +12 -9 lines
merge to -current.

Revision 1.48: download - view: text, markup, annotated - select for diffs
Fri Feb 17 18:40:18 2012 UTC (12 years, 9 months ago) by bouyer
Branches: MAIN
CVS tags: jmcneill-usbmp-base5, jmcneill-usbmp-base3, jmcneill-usbmp-base2
Diff to: previous 1.47: preferred, colored
Changes since revision 1.47: +4 -2 lines
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.

Revision 1.47: download - view: text, markup, annotated - select for diffs
Sun Feb 12 14:38:18 2012 UTC (12 years, 10 months ago) by jym
Branches: MAIN
CVS tags: netbsd-6-base
Branch point for: netbsd-6
Diff to: previous 1.46: preferred, colored
Changes since revision 1.46: +3 -3 lines
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.

Revision 1.46: download - view: text, markup, annotated - select for diffs
Sat Jan 28 07:19:17 2012 UTC (12 years, 10 months ago) by cherry
Branches: MAIN
Diff to: previous 1.45: preferred, colored
Changes since revision 1.45: +4 -3 lines
stop using alternate pde mapping in xen pmap

Revision 1.45: download - view: text, markup, annotated - select for diffs
Fri Dec 30 17:57:49 2011 UTC (12 years, 11 months ago) by cherry
Branches: MAIN
Diff to: previous 1.44: preferred, colored
Changes since revision 1.44: +2 -2 lines
Move the per-cpu l3 page allocation code to a separate MD function. Avoids code duplication for xen PAE

Revision 1.44: download - view: text, markup, annotated - select for diffs
Wed Dec 7 15:47:42 2011 UTC (13 years ago) by cegger
Branches: MAIN
Diff to: previous 1.43: preferred, colored
Changes since revision 1.43: +3 -3 lines
switch from xen3-public to xen-public.

Revision 1.43: download - view: text, markup, annotated - select for diffs
Sat Nov 19 17:13:39 2011 UTC (13 years ago) by cherry
Branches: MAIN
CVS tags: jmcneill-usbmp-pre-base2, jmcneill-usbmp-base, jmcneill-audiomp3-base, jmcneill-audiomp3
Branch point for: jmcneill-usbmp
Diff to: previous 1.42: preferred, colored
Changes since revision 1.42: +2 -1 lines
[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).

Revision 1.40.2.1: download - view: text, markup, annotated - select for diffs
Thu Nov 10 14:31:43 2011 UTC (13 years, 1 month ago) by yamt
Branches: yamt-pagecache
Diff to: previous 1.40: preferred, colored
Changes since revision 1.40: +10 -12 lines
sync with head

Revision 1.42: download - view: text, markup, annotated - select for diffs
Thu Nov 10 00:12:05 2011 UTC (13 years, 1 month ago) by jym
Branches: MAIN
CVS tags: yamt-pagecache-base3
Diff to: previous 1.41: preferred, colored
Changes since revision 1.41: +2 -2 lines
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.

Revision 1.41: download - view: text, markup, annotated - select for diffs
Sun Nov 6 15:18:18 2011 UTC (13 years, 1 month ago) by cherry
Branches: MAIN
CVS tags: yamt-pagecache-base2
Diff to: previous 1.40: preferred, colored
Changes since revision 1.40: +9 -11 lines
[merging from cherry-xenmp] make pmap_kernel() shadow PMD per-cpu and MP aware.

Revision 1.40: download - view: text, markup, annotated - select for diffs
Tue Nov 1 21:21:32 2011 UTC (13 years, 1 month ago) by joerg
Branches: MAIN
CVS tags: yamt-pagecache-base
Branch point for: yamt-pagecache
Diff to: previous 1.39: preferred, colored
Changes since revision 1.39: +7 -2 lines
Reduce exposure of kernel internals for __KMEMUSER

Revision 1.34.2.7: download - view: text, markup, annotated - select for diffs
Sat Oct 22 19:21:57 2011 UTC (13 years, 1 month ago) by bouyer
Branches: cherry-xenmp
Diff to: previous 1.34.2.6: preferred, colored; branchpoint 1.34: preferred, colored; next MAIN 1.35: preferred, colored
Changes since revision 1.34.2.6: +2 -1 lines
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).

Revision 1.39: download - view: text, markup, annotated - select for diffs
Mon Oct 17 22:38:01 2011 UTC (13 years, 2 months ago) by jmcneill
Branches: MAIN
Diff to: previous 1.38: preferred, colored
Changes since revision 1.38: +2 -1 lines
add a "vm" device class for cpufeaturebus

Revision 1.38: download - view: text, markup, annotated - select for diffs
Tue Sep 20 00:12:23 2011 UTC (13 years, 2 months ago) by jym
Branches: MAIN
Diff to: previous 1.37: preferred, colored
Changes since revision 1.37: +3 -1 lines
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.

Revision 1.34.2.6: download - view: text, markup, annotated - select for diffs
Thu Sep 1 08:04:46 2011 UTC (13 years, 3 months ago) by cherry
Branches: cherry-xenmp
Diff to: previous 1.34.2.5: preferred, colored; branchpoint 1.34: preferred, colored
Changes since revision 1.34.2.5: +2 -2 lines
fix %cr3 init. from mhitch@, tested by riz@ & mhitch@

Revision 1.10.2.9: download - view: text, markup, annotated - select for diffs
Sat Aug 27 15:37:29 2011 UTC (13 years, 3 months ago) by jym
Branches: jym-xensuspend
Diff to: previous 1.10.2.8: preferred, colored; branchpoint 1.10: preferred, colored; next MAIN 1.11: preferred, colored
Changes since revision 1.10.2.8: +22 -8 lines
Sync with HEAD. Most notably: uvm/pmap work done by rmind@, and MP Xen
work of cherry@.

No regression observed on suspend/restore.

Revision 1.34.2.5: download - view: text, markup, annotated - select for diffs
Sat Aug 20 19:22:47 2011 UTC (13 years, 3 months ago) by cherry
Branches: cherry-xenmp
Diff to: previous 1.34.2.4: preferred, colored; branchpoint 1.34: preferred, colored
Changes since revision 1.34.2.4: +7 -10 lines
PAE MP support (preliminary), amd64 per-cpu L4 model redesigned, i386 pmap_pa_start/end fixup

Revision 1.34.2.4: download - view: text, markup, annotated - select for diffs
Wed Aug 17 09:40:39 2011 UTC (13 years, 4 months ago) by cherry
Branches: cherry-xenmp
Diff to: previous 1.34.2.3: preferred, colored; branchpoint 1.34: preferred, colored
Changes since revision 1.34.2.3: +3 -3 lines
Pullup relevant changes from -current

Revision 1.37: download - view: text, markup, annotated - select for diffs
Thu Aug 11 18:11:17 2011 UTC (13 years, 4 months ago) by cherry
Branches: MAIN
CVS tags: jym-xensuspend-nbase, jym-xensuspend-base
Diff to: previous 1.36: preferred, colored
Changes since revision 1.36: +3 -1 lines
Hide the MD details of specific IPIs behind semantically pleasing functions. This cleans up a couple of #ifdef XEN/#endif pairs

Revision 1.36: download - view: text, markup, annotated - select for diffs
Wed Aug 10 06:40:35 2011 UTC (13 years, 4 months ago) by cherry
Branches: MAIN
Diff to: previous 1.35: preferred, colored
Changes since revision 1.35: +19 -7 lines
Add Xen specific members to struct cpu_info, Add proper per-cpu curcpu() functionality

Revision 1.34.2.3: download - view: text, markup, annotated - select for diffs
Sat Jul 16 10:59:45 2011 UTC (13 years, 5 months ago) by cherry
Branches: cherry-xenmp
Diff to: previous 1.34.2.2: preferred, colored; branchpoint 1.34: preferred, colored
Changes since revision 1.34.2.2: +8 -1 lines
Introduce a per-cpu "shadow" for pmap_kernel()'s L4 page

Revision 1.34.2.2: download - view: text, markup, annotated - select for diffs
Thu Jun 23 14:19:48 2011 UTC (13 years, 5 months ago) by cherry
Branches: cherry-xenmp
Diff to: previous 1.34.2.1: preferred, colored; branchpoint 1.34: preferred, colored
Changes since revision 1.34.2.1: +2 -2 lines
Catchup with rmind-uvmplock merge.

Revision 1.35: download - view: text, markup, annotated - select for diffs
Sun Jun 12 03:35:50 2011 UTC (13 years, 6 months ago) by rmind
Branches: MAIN
Diff to: previous 1.34: preferred, colored
Changes since revision 1.34: +2 -2 lines
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.

Revision 1.20.4.6: download - view: text, markup, annotated - select for diffs
Sun Jun 12 00:24:10 2011 UTC (13 years, 6 months ago) by rmind
Branches: rmind-uvmplock
Diff to: previous 1.20.4.5: preferred, colored; branchpoint 1.20: preferred, colored; next MAIN 1.21: preferred, colored
Changes since revision 1.20.4.5: +0 -2 lines
sync with head

Revision 1.26.2.1: download - view: text, markup, annotated - select for diffs
Mon Jun 6 09:07:06 2011 UTC (13 years, 6 months ago) by jruoho
Branches: jruoho-x86intr
Diff to: previous 1.26: preferred, colored; next MAIN 1.27: preferred, colored
Changes since revision 1.26: +10 -9 lines
Sync with HEAD.

Revision 1.34.2.1: download - view: text, markup, annotated - select for diffs
Fri Jun 3 13:27:38 2011 UTC (13 years, 6 months ago) by cherry
Branches: cherry-xenmp
Diff to: previous 1.34: preferred, colored
Changes since revision 1.34: +14 -7 lines
Initial import of xen MP sources, with kernel and userspace tests.
 - this is a source priview.
 - boots to single user.
 - spurious interrupt and pmap related panics are normal

Revision 1.34: download - view: text, markup, annotated - select for diffs
Tue May 31 23:28:52 2011 UTC (13 years, 6 months ago) by dyoung
Branches: MAIN
CVS tags: rmind-uvmplock-nbase, rmind-uvmplock-base, cherry-xenmp-base
Branch point for: cherry-xenmp
Diff to: previous 1.33: preferred, colored
Changes since revision 1.33: +1 -3 lines
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.

Revision 1.20.4.5: download - view: text, markup, annotated - select for diffs
Tue May 31 03:04:23 2011 UTC (13 years, 6 months ago) by rmind
Branches: rmind-uvmplock
Diff to: previous 1.20.4.4: preferred, colored; branchpoint 1.20: preferred, colored
Changes since revision 1.20.4.4: +2 -0 lines
sync with head

Revision 1.33: download - view: text, markup, annotated - select for diffs
Thu May 26 04:25:28 2011 UTC (13 years, 6 months ago) by uebayasi
Branches: MAIN
Diff to: previous 1.32: preferred, colored
Changes since revision 1.32: +3 -1 lines
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

Revision 1.9.10.2: download - view: text, markup, annotated - select for diffs
Fri May 20 08:11:24 2011 UTC (13 years, 6 months ago) by matt
Branches: matt-nb5-mips64
Diff to: previous 1.9.10.1: preferred, colored; branchpoint 1.9: preferred, colored; next MAIN 1.10: preferred, colored
Changes since revision 1.9.10.1: +1 -4 lines
bring matt-nb5-mips64 up to date with netbsd-5-1-RELEASE (except compat).

Revision 1.10.2.8: download - view: text, markup, annotated - select for diffs
Mon May 2 22:49:57 2011 UTC (13 years, 7 months ago) by jym
Branches: jym-xensuspend
Diff to: previous 1.10.2.7: preferred, colored; branchpoint 1.10: preferred, colored
Changes since revision 1.10.2.7: +7 -7 lines
Sync with head.

Revision 1.20.4.4: download - view: text, markup, annotated - select for diffs
Thu Apr 21 01:41:31 2011 UTC (13 years, 7 months ago) by rmind
Branches: rmind-uvmplock
Diff to: previous 1.20.4.3: preferred, colored; branchpoint 1.20: preferred, colored
Changes since revision 1.20.4.3: +6 -6 lines
sync with head

Revision 1.32: download - view: text, markup, annotated - select for diffs
Wed Apr 13 06:29:30 2011 UTC (13 years, 8 months ago) by mrg
Branches: MAIN
Diff to: previous 1.31: preferred, colored
Changes since revision 1.31: +7 -7 lines
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.

Revision 1.10.2.7: download - view: text, markup, annotated - select for diffs
Mon Mar 28 23:04:49 2011 UTC (13 years, 8 months ago) by jym
Branches: jym-xensuspend
Diff to: previous 1.10.2.6: preferred, colored; branchpoint 1.10: preferred, colored
Changes since revision 1.10.2.6: +4 -3 lines
Sync with HEAD. TODO before merge:
- shortcut for suspend code in sysmon, when powerd(8) is not running.
Borrow ``xs_watch'' thread context?
- bug hunting in xbd + xennet resume. Rings are currently thrashed upon
resume, so current implementation force flush them on suspend. It's not
really needed.

Revision 1.20.4.3: download - view: text, markup, annotated - select for diffs
Sat Mar 5 20:52:27 2011 UTC (13 years, 9 months ago) by rmind
Branches: rmind-uvmplock
Diff to: previous 1.20.4.2: preferred, colored; branchpoint 1.20: preferred, colored
Changes since revision 1.20.4.2: +20 -4 lines
sync with head

Revision 1.26.4.1: download - view: text, markup, annotated - select for diffs
Sat Mar 5 15:10:10 2011 UTC (13 years, 9 months ago) by bouyer
Branches: bouyer-quota2
Diff to: previous 1.26: preferred, colored; next MAIN 1.27: preferred, colored
Changes since revision 1.26: +4 -3 lines
Sync with HEAD

Revision 1.31: download - view: text, markup, annotated - select for diffs
Thu Feb 24 15:42:17 2011 UTC (13 years, 9 months ago) by jruoho
Branches: MAIN
CVS tags: bouyer-quota2-nbase
Diff to: previous 1.30: preferred, colored
Changes since revision 1.30: +2 -2 lines
Fix autoconf(9) of cpufeaturebus.

Revision 1.30: download - view: text, markup, annotated - select for diffs
Wed Feb 23 11:43:22 2011 UTC (13 years, 9 months ago) by jruoho
Branches: MAIN
Diff to: previous 1.29: preferred, colored
Changes since revision 1.29: +2 -1 lines
Move ENHANCED_SPEEDSTEP, or henceforth est(4), to the cpufeaturebus.

Revision 1.29: download - view: text, markup, annotated - select for diffs
Sun Feb 20 13:42:45 2011 UTC (13 years, 9 months ago) by jruoho
Branches: MAIN
Diff to: previous 1.28: preferred, colored
Changes since revision 1.28: +2 -1 lines
Modularize coretemp(4). Ok jmcneill@.

Revision 1.28: download - view: text, markup, annotated - select for diffs
Sun Feb 20 12:47:21 2011 UTC (13 years, 9 months ago) by jmcneill
Branches: MAIN
Diff to: previous 1.27: preferred, colored
Changes since revision 1.27: +1 -2 lines
cpu.h no longer needs via_padlock.h

Revision 1.27: download - view: text, markup, annotated - select for diffs
Sat Feb 19 13:52:28 2011 UTC (13 years, 9 months ago) by jmcneill
Branches: MAIN
Diff to: previous 1.26: preferred, colored
Changes since revision 1.26: +2 -2 lines
modularize VIA PadLock support
 - retire options VIA_PADLOCK, replace with 'padlock0 at cpu0'
 - driver supports attach & detach
 - support building as a module

Revision 1.10.2.6: download - view: text, markup, annotated - select for diffs
Mon Jan 10 00:37:36 2011 UTC (13 years, 11 months ago) by jym
Branches: jym-xensuspend
Diff to: previous 1.10.2.5: preferred, colored; branchpoint 1.10: preferred, colored
Changes since revision 1.10.2.5: +2 -2 lines
Sync with HEAD

Revision 1.26: download - view: text, markup, annotated - select for diffs
Wed Dec 22 04:15:01 2010 UTC (13 years, 11 months ago) by christos
Branches: MAIN
CVS tags: uebayasi-xip-base7, matt-mips64-premerge-20101231, jruoho-x86intr-base, bouyer-quota2-base
Branch point for: jruoho-x86intr, bouyer-quota2
Diff to: previous 1.25: preferred, colored
Changes since revision 1.25: +2 -2 lines
Make __HAVE_CPU_DATA_FIRST true

Revision 1.10.2.5: download - view: text, markup, annotated - select for diffs
Sun Oct 24 22:48:16 2010 UTC (14 years, 1 month ago) by jym
Branches: jym-xensuspend
Diff to: previous 1.10.2.4: preferred, colored; branchpoint 1.10: preferred, colored
Changes since revision 1.10.2.4: +30 -17 lines
Sync with HEAD

Revision 1.20.2.3: download - view: text, markup, annotated - select for diffs
Fri Oct 22 07:21:40 2010 UTC (14 years, 1 month ago) by uebayasi
Branches: uebayasi-xip
Diff to: previous 1.20.2.2: preferred, colored; branchpoint 1.20: preferred, colored; next MAIN 1.21: preferred, colored
Changes since revision 1.20.2.2: +1 -0 lines
Sync with HEAD (-D20101022).

Revision 1.4.2.6: download - view: text, markup, annotated - select for diffs
Sat Oct 9 03:31:56 2010 UTC (14 years, 2 months ago) by yamt
Branches: yamt-nfs-mp
Diff to: previous 1.4.2.5: preferred, colored; branchpoint 1.4: preferred, colored; next MAIN 1.5: preferred, colored
Changes since revision 1.4.2.5: +2 -1 lines
sync with head

Revision 1.20.2.2: download - view: text, markup, annotated - select for diffs
Tue Aug 17 06:45:30 2010 UTC (14 years, 4 months ago) by uebayasi
Branches: uebayasi-xip
Diff to: previous 1.20.2.1: preferred, colored; branchpoint 1.20: preferred, colored
Changes since revision 1.20.2.1: +14 -3 lines
Sync with HEAD.

Revision 1.25: download - view: text, markup, annotated - select for diffs
Mon Aug 16 19:39:06 2010 UTC (14 years, 4 months ago) by jym
Branches: MAIN
CVS tags: yamt-nfs-mp-base11, uebayasi-xip-base6, uebayasi-xip-base5, uebayasi-xip-base4, uebayasi-xip-base3
Diff to: previous 1.24: preferred, colored
Changes since revision 1.24: +2 -1 lines
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.

Revision 1.4.2.5: download - view: text, markup, annotated - select for diffs
Wed Aug 11 22:52:55 2010 UTC (14 years, 4 months ago) by yamt
Branches: yamt-nfs-mp
Diff to: previous 1.4.2.4: preferred, colored; branchpoint 1.4: preferred, colored
Changes since revision 1.4.2.4: +23 -12 lines
sync with head.

Revision 1.24: download - view: text, markup, annotated - select for diffs
Wed Aug 4 10:02:11 2010 UTC (14 years, 4 months ago) by jruoho
Branches: MAIN
CVS tags: yamt-nfs-mp-base10, uebayasi-xip-base2
Diff to: previous 1.23: preferred, colored
Changes since revision 1.23: +2 -1 lines
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.

Revision 1.23: download - view: text, markup, annotated - select for diffs
Sat Jul 24 00:45:56 2010 UTC (14 years, 4 months ago) by jym
Branches: MAIN
Diff to: previous 1.22: preferred, colored
Changes since revision 1.22: +14 -1 lines
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).

Revision 1.20.4.2: download - view: text, markup, annotated - select for diffs
Sun May 30 05:17:12 2010 UTC (14 years, 6 months ago) by rmind
Branches: rmind-uvmplock
Diff to: previous 1.20.4.1: preferred, colored; branchpoint 1.20: preferred, colored
Changes since revision 1.20.4.1: +9 -12 lines
sync with head

Revision 1.22: download - view: text, markup, annotated - select for diffs
Sun May 9 20:32:41 2010 UTC (14 years, 7 months ago) by rmind
Branches: MAIN
Diff to: previous 1.21: preferred, colored
Changes since revision 1.21: +1 -4 lines
Drop x86 MD package/core/smt IDs and use MI.

Revision 1.20.2.1: download - view: text, markup, annotated - select for diffs
Fri Apr 30 14:39:57 2010 UTC (14 years, 7 months ago) by uebayasi
Branches: uebayasi-xip
Diff to: previous 1.20: preferred, colored
Changes since revision 1.20: +9 -9 lines
Sync with HEAD.

Revision 1.20.4.1: download - view: text, markup, annotated - select for diffs
Mon Apr 26 02:43:34 2010 UTC (14 years, 7 months ago) by rmind
Branches: rmind-uvmplock
Diff to: previous 1.20: preferred, colored
Changes since revision 1.20: +2 -2 lines
Apply renovated patch to significantly reduce TLB shootdowns in x86 pmap,
also provide TLBSTATS option to measure and track TLB shootdowns.  Details:

http://mail-index.netbsd.org/port-i386/2009/01/11/msg001018.html

Patch from Andrew Doran, proposed on tech-x86 [sic], in January 2009.

XXX: amd64 and xen are not yet; work in progress.

Revision 1.9.8.1: download - view: text, markup, annotated - select for diffs
Fri Apr 23 04:17:30 2010 UTC (14 years, 7 months ago) by snj
Branches: netbsd-5-0
Diff to: previous 1.9: preferred, colored; next MAIN 1.10: preferred, colored
Changes since revision 1.9: +1 -4 lines
Apply patch (requested by jym in ticket #1380):
Fix 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).

Revision 1.9.4.2: download - view: text, markup, annotated - select for diffs
Thu Apr 22 20:02:48 2010 UTC (14 years, 7 months ago) by snj
Branches: netbsd-5
CVS tags: netbsd-5-2-RELEASE, netbsd-5-2-RC1, netbsd-5-2-3-RELEASE, netbsd-5-2-2-RELEASE, netbsd-5-2-1-RELEASE, netbsd-5-2, netbsd-5-1-RELEASE, netbsd-5-1-RC4, netbsd-5-1-RC3, netbsd-5-1-RC2, netbsd-5-1-RC1, netbsd-5-1-5-RELEASE, netbsd-5-1-4-RELEASE, netbsd-5-1-3-RELEASE, netbsd-5-1-2-RELEASE, netbsd-5-1-1-RELEASE, netbsd-5-1, matt-nb5-pq3-base, matt-nb5-pq3
Diff to: previous 1.9.4.1: preferred, colored; branchpoint 1.9: preferred, colored; next MAIN 1.10: preferred, colored
Changes since revision 1.9.4.1: +1 -4 lines
Apply patch (requested by jym in ticket #1380):
Fix 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).

Revision 1.9.10.1: download - view: text, markup, annotated - select for diffs
Wed Apr 21 00:33:45 2010 UTC (14 years, 7 months ago) by matt
Branches: matt-nb5-mips64
CVS tags: matt-nb5-mips64-premerge-20101231, matt-nb5-mips64-k15
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +4 -1 lines
sync to netbsd-5

Revision 1.21: download - view: text, markup, annotated - select for diffs
Sun Apr 18 23:47:51 2010 UTC (14 years, 7 months ago) by jym
Branches: MAIN
CVS tags: uebayasi-xip-base1
Diff to: previous 1.20: preferred, colored
Changes since revision 1.20: +9 -9 lines
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.

Revision 1.4.2.4: download - view: text, markup, annotated - select for diffs
Thu Mar 11 15:03:08 2010 UTC (14 years, 9 months ago) by yamt
Branches: yamt-nfs-mp
Diff to: previous 1.4.2.3: preferred, colored; branchpoint 1.4: preferred, colored
Changes since revision 1.4.2.3: +7 -6 lines
sync with head

Revision 1.20: download - view: text, markup, annotated - select for diffs
Mon Jan 18 16:40:17 2010 UTC (14 years, 10 months ago) by rmind
Branches: MAIN
CVS tags: yamt-nfs-mp-base9, uebayasi-xip-base
Branch point for: uebayasi-xip, rmind-uvmplock
Diff to: previous 1.19: preferred, colored
Changes since revision 1.19: +2 -2 lines
x86_cpu_topology, not toplogy.

Revision 1.19: download - view: text, markup, annotated - select for diffs
Sat Jan 9 20:56:17 2010 UTC (14 years, 11 months ago) by cegger
Branches: MAIN
Diff to: previous 1.18: preferred, colored
Changes since revision 1.18: +5 -4 lines
add x2apic support.
patch presented on current-users@, port-i386@ and port-amd64@ on 2009-12-22

No comments.

Revision 1.18: download - view: text, markup, annotated - select for diffs
Sat Nov 21 03:11:01 2009 UTC (15 years ago) by rmind
Branches: MAIN
CVS tags: matt-premerge-20091211
Diff to: previous 1.17: preferred, colored
Changes since revision 1.17: +2 -2 lines
Use lwp_getpcb() on x86 MD code, clean from struct user usage.

Revision 1.10.2.4: download - view: text, markup, annotated - select for diffs
Sun Nov 1 21:43:29 2009 UTC (15 years, 1 month ago) by jym
Branches: jym-xensuspend
Diff to: previous 1.10.2.3: preferred, colored; branchpoint 1.10: preferred, colored
Changes since revision 1.10.2.3: +3 -1 lines
- Upgrade suspend/resume code to comply with Xen2 removal.
- Add support for PAE domUs suspend/resume.
- Fix an issue regarding initialization of the xbd ring I/O that could end
badly during resume, with invalid block operations submitted to dom0 backend.

NetBSD supports PAE under x86_32 by considering the L2 page as being
4 pages long instead of 1.

Xen validates the page types during resume. Sadly, the hypervisor handles
alternative recursive mappings (== PG/PD entries pointing to pages other
than self) inadequately, which could lead to incorrect page pinning.

As a result, the important change with this patch is to clear these alternative
mappings during suspend, and reset them back to their former self upon
resume. For PAE, approx. all 4 PDIR_SLOT_PTEs could be considered as
alternative recursive mappings.

See comments in pmap.c for further details.

Now, let the testing and bug hunting begin.

Revision 1.10.2.3: download - view: text, markup, annotated - select for diffs
Sun Nov 1 13:58:16 2009 UTC (15 years, 1 month ago) by jym
Branches: jym-xensuspend
Diff to: previous 1.10.2.2: preferred, colored; branchpoint 1.10: preferred, colored
Changes since revision 1.10.2.2: +0 -1 lines
Sync with HEAD.

Revision 1.9.4.1: download - view: text, markup, annotated - select for diffs
Tue Jun 16 02:19:44 2009 UTC (15 years, 6 months ago) by snj
Branches: netbsd-5
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +4 -1 lines
Pull up following revision(s) (requested by rmind in ticket #782):
	sys/arch/x86/conf/files.x86: revision 1.52 via patch
	sys/arch/x86/include/cpu.h: revision 1.17
	sys/arch/x86/x86/cpu_topology.c: revision 1.1
	sys/arch/x86/x86/identcpu.c: revision 1.16 via patch
Move x86 CPU topology detection code into the separate file (as it was
originally).
OK by <yamt>.

Revision 1.10.2.2: download - view: text, markup, annotated - select for diffs
Wed May 13 17:18:44 2009 UTC (15 years, 7 months ago) by jym
Branches: jym-xensuspend
Diff to: previous 1.10.2.1: preferred, colored; branchpoint 1.10: preferred, colored
Changes since revision 1.10.2.1: +31 -6 lines
Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.

Revision 1.4.2.3: download - view: text, markup, annotated - select for diffs
Mon May 4 08:12:09 2009 UTC (15 years, 7 months ago) by yamt
Branches: yamt-nfs-mp
Diff to: previous 1.4.2.2: preferred, colored; branchpoint 1.4: preferred, colored
Changes since revision 1.4.2.2: +40 -12 lines
sync with head.

Revision 1.17: download - view: text, markup, annotated - select for diffs
Thu Apr 30 00:07:23 2009 UTC (15 years, 7 months ago) by rmind
Branches: MAIN
CVS tags: yamt-nfs-mp-base8, yamt-nfs-mp-base7, yamt-nfs-mp-base6, yamt-nfs-mp-base5, yamt-nfs-mp-base4, yamt-nfs-mp-base3, jymxensuspend-base
Diff to: previous 1.16: preferred, colored
Changes since revision 1.16: +4 -1 lines
Move x86 CPU topology detection code into the separate file (as it was originally).
OK by <yamt>.

Revision 1.9.2.2: download - view: text, markup, annotated - select for diffs
Tue Apr 28 07:34:56 2009 UTC (15 years, 7 months ago) by skrll
Branches: nick-hppapmap
Diff to: previous 1.9.2.1: preferred, colored; branchpoint 1.9: preferred, colored; next MAIN 1.10: preferred, colored
Changes since revision 1.9.2.1: +28 -6 lines
Sync with HEAD.

Revision 1.16: download - view: text, markup, annotated - select for diffs
Sun Apr 19 14:11:37 2009 UTC (15 years, 7 months ago) by ad
Branches: MAIN
CVS tags: nick-hppapmap-base4, nick-hppapmap-base3, nick-hppapmap-base
Diff to: previous 1.15: preferred, colored
Changes since revision 1.15: +2 -1 lines
cpuctl:

- Add interrupt shielding (direct hardware interrupts away from the
  specified CPUs). Not documented just yet but will be soon.

- Redo /dev/cpu time_t compat so no kernel changes are needed.

x86:

- Make intr_establish, intr_disestablish safe to use when !cold.

- Distribute hardware interrupts among the CPUs, instead of directing
  everything to the boot CPU.

- Add MD code for interrupt sheilding. This works in most cases but there is
  a bug where delivery is not accepted by an LAPIC after redistribution. It
  also needs re-balancing to make things fair after interrupts are turned
  back on for a CPU.

Revision 1.15: download - view: text, markup, annotated - select for diffs
Thu Apr 16 15:34:23 2009 UTC (15 years, 8 months ago) by rmind
Branches: MAIN
Diff to: previous 1.14: preferred, colored
Changes since revision 1.14: +18 -1 lines
- Add macros to handle (some) trapframe registers for common x86 code.
- Merge i386 and amd64 syscall.c into x86.  No functional changes intended.

Proposed on (port-i386 & port-amd64).  Unfortunately, I cannot merge these
lists into the single port-x86. :(

Revision 1.14: download - view: text, markup, annotated - select for diffs
Mon Mar 30 09:51:37 2009 UTC (15 years, 8 months ago) by tsutsui
Branches: MAIN
Diff to: previous 1.13: preferred, colored
Changes since revision 1.13: +3 -3 lines
#include <sys/types.h>, not <stdbool.h> for userland
in defined(_STANDALONE) case too.

Revision 1.13: download - view: text, markup, annotated - select for diffs
Sat Mar 28 21:34:17 2009 UTC (15 years, 8 months ago) by rmind
Branches: MAIN
Diff to: previous 1.12: preferred, colored
Changes since revision 1.12: +2 -2 lines
kvtop: change return type to paddr_t.

Revision 1.12: download - view: text, markup, annotated - select for diffs
Fri Mar 27 16:07:37 2009 UTC (15 years, 8 months ago) by dyoung
Branches: MAIN
Diff to: previous 1.11: preferred, colored
Changes since revision 1.11: +7 -1 lines
If defined(_KERNEL), #include <sys/types.h>, otherwise #include
<stdbool.h>, for the bool definition that we need. cpu.h only got the
definition by chance, before.

Revision 1.11: download - view: text, markup, annotated - select for diffs
Sat Mar 7 21:59:25 2009 UTC (15 years, 9 months ago) by ad
Branches: MAIN
Diff to: previous 1.10: preferred, colored
Changes since revision 1.10: +3 -5 lines
Expose more stuff if _KMEMUSER is defined.

Revision 1.10.2.1: download - view: text, markup, annotated - select for diffs
Mon Feb 9 00:03:55 2009 UTC (15 years, 10 months ago) by jym
Branches: jym-xensuspend
Diff to: previous 1.10: preferred, colored
Changes since revision 1.10: +2 -1 lines
Initial code for xen save/restore/migrate facilities.

- split the attach code of frontends in two half: one that is only needed
during autoconf(9) attach/detach phases, and one used at each save/restore
of device state (between suspend and resume).

Applies to hypervisor, xencons, xenbus, xbd, and xennet.

- add a rwlock(9) ("ptom_lock") to protect the different parts in the kernel
 that manipulate MFNs (which could change between a suspend and a resume,
without the kernel noticing it). Parts that require MFNs acquire a reader lock,
while suspend code will acquire a writer lock to ensure that no-other parts
in kernel still use MFNs.

- integrate the suspend code with sysmon.

- various things in pmap(9), and clock.

TODO:
- factorize code a bit more inside frontends drivers.
- remove all alternative recursive (APDP_PDE) mappings found in PD/PT during
suspend, as Xen does not support them.
- abstract the ptom_lock locking, it is only required when kernel preemption
is enabled, or on MP systems.

Current code works mostly. You may experience difficulties in some corner
cases (dom0 warnings about xennet interface errors, and Xen tools failing to
 validate NetBSD's alternative pmaps).

Revision 1.9.2.1: download - view: text, markup, annotated - select for diffs
Mon Jan 19 13:17:09 2009 UTC (15 years, 10 months ago) by skrll
Branches: nick-hppapmap
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +2 -2 lines
Sync with HEAD.

Revision 1.7.2.3: download - view: text, markup, annotated - select for diffs
Sat Jan 17 13:28:38 2009 UTC (15 years, 11 months ago) by mjf
Branches: mjf-devfs2
Diff to: previous 1.7.2.2: preferred, colored; branchpoint 1.7: preferred, colored; next MAIN 1.8: preferred, colored
Changes since revision 1.7.2.2: +4 -2 lines
Sync with HEAD.

Revision 1.10: download - view: text, markup, annotated - select for diffs
Mon Dec 29 19:59:09 2008 UTC (15 years, 11 months ago) by pooka
Branches: MAIN
CVS tags: nick-hppapmap-base2, mjf-devfs2-base
Branch point for: jym-xensuspend
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +2 -2 lines
_LKM -> _MODULE

Revision 1.7.8.2: download - view: text, markup, annotated - select for diffs
Sat Dec 13 01:13:38 2008 UTC (16 years ago) by haad
Branches: haad-dm
Diff to: previous 1.7.8.1: preferred, colored; branchpoint 1.7: preferred, colored; next MAIN 1.8: preferred, colored
Changes since revision 1.7.8.1: +2 -1 lines
Update haad-dm branch to haad-dm-base2.

Revision 1.9: download - view: text, markup, annotated - select for diffs
Sat Oct 25 19:13:40 2008 UTC (16 years, 1 month ago) by mrg
Branches: MAIN
CVS tags: netbsd-5-base, netbsd-5-0-RELEASE, netbsd-5-0-RC4, netbsd-5-0-RC3, netbsd-5-0-RC2, netbsd-5-0-RC1, netbsd-5-0-2-RELEASE, netbsd-5-0-1-RELEASE, matt-nb5-mips64-u2-k2-k4-k7-k8-k9, matt-nb5-mips64-u1-k1-k5, matt-nb5-mips64-premerge-20091211, matt-nb4-mips64-k7-u2a-k9b, haad-nbase2, haad-dm-base2, haad-dm-base, ad-audiomp2-base, ad-audiomp2
Branch point for: nick-hppapmap, netbsd-5-0, netbsd-5, matt-nb5-mips64
Diff to: previous 1.8: preferred, colored
Changes since revision 1.8: +2 -1 lines
this uses an evcnt so, include <sys/evcnt.h>

Revision 1.7.8.1: download - view: text, markup, annotated - select for diffs
Sun Oct 19 22:16:07 2008 UTC (16 years, 1 month ago) by haad
Branches: haad-dm
Diff to: previous 1.7: preferred, colored
Changes since revision 1.7: +3 -2 lines
Sync with HEAD.

Revision 1.8: download - view: text, markup, annotated - select for diffs
Mon Oct 13 21:11:47 2008 UTC (16 years, 2 months ago) by cegger
Branches: MAIN
CVS tags: matt-mips64-base2, haad-dm-base1
Diff to: previous 1.7: preferred, colored
Changes since revision 1.7: +3 -2 lines
print features4: cpuid fn80000001 %ecx on AMD CPUs.

Revision 1.7.6.2: download - view: text, markup, annotated - select for diffs
Mon Jun 23 05:02:12 2008 UTC (16 years, 5 months ago) by wrstuden
Branches: wrstuden-revivesa
Diff to: previous 1.7.6.1: preferred, colored; branchpoint 1.7: preferred, colored; next MAIN 1.8: preferred, colored
Changes since revision 1.7.6.1: +454 -0 lines
Add files to branch that were added on -current.

After this, all that's left of update is to merge some changes
that had conflicts.

Revision 1.4.4.3: download - view: text, markup, annotated - select for diffs
Wed Jun 4 02:04:58 2008 UTC (16 years, 6 months ago) by yamt
Branches: yamt-pf42
Diff to: previous 1.4.4.2: preferred, colored; branchpoint 1.4: preferred, colored; next MAIN 1.5: preferred, colored
Changes since revision 1.4.4.2: +5 -4 lines
sync with head

Revision 1.7.2.2: download - view: text, markup, annotated - select for diffs
Mon Jun 2 13:22:50 2008 UTC (16 years, 6 months ago) by mjf
Branches: mjf-devfs2
Diff to: previous 1.7.2.1: preferred, colored; branchpoint 1.7: preferred, colored
Changes since revision 1.7.2.1: +454 -0 lines
Sync with HEAD.

Revision 1.7.6.1
Fri May 30 11:03:29 2008 UTC (16 years, 6 months ago) by wrstuden
Branches: wrstuden-revivesa
FILE REMOVED
Changes since revision 1.7: +0 -454 lines
file cpu.h was added on branch wrstuden-revivesa on 2008-06-23 05:02:12 +0000

Revision 1.7.2.1
Fri May 30 11:03:29 2008 UTC (16 years, 6 months ago) by mjf
Branches: mjf-devfs2
FILE REMOVED
Changes since revision 1.7: +0 -454 lines
file cpu.h was added on branch mjf-devfs2 on 2008-06-02 13:22:50 +0000

Revision 1.7: download - view: text, markup, annotated - select for diffs
Fri May 30 11:03:29 2008 UTC (16 years, 6 months ago) by ad
Branches: MAIN
CVS tags: yamt-pf42-base4, yamt-pf42-base3, wrstuden-revivesa-base-4, wrstuden-revivesa-base-3, wrstuden-revivesa-base-2, wrstuden-revivesa-base-1, wrstuden-revivesa-base, simonb-wapbl-nbase, simonb-wapbl-base, simonb-wapbl
Branch point for: wrstuden-revivesa, mjf-devfs2, haad-dm
Diff to: previous 1.6: preferred, colored
Changes since revision 1.6: +1 -2 lines
fillw is dead.

Revision 1.6: download - view: text, markup, annotated - select for diffs
Wed May 28 11:50:01 2008 UTC (16 years, 6 months ago) by ad
Branches: MAIN
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +1 -3 lines
Remove X86_MAXPROCS. There is still a 32-cpu limit, but it's now using
the MI constants.

Revision 1.5: download - view: text, markup, annotated - select for diffs
Thu May 22 13:55:51 2008 UTC (16 years, 6 months ago) by ad
Branches: MAIN
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +6 -2 lines
Mark x86_curlwp() with __attribute__ ((const)), so gcc can CSE it and know
that it does not clobber global data.

Revision 1.4.4.2: download - view: text, markup, annotated - select for diffs
Sun May 18 12:33:01 2008 UTC (16 years, 7 months ago) by yamt
Branches: yamt-pf42
Diff to: previous 1.4.4.1: preferred, colored; branchpoint 1.4: preferred, colored
Changes since revision 1.4.4.1: +453 -0 lines
sync with head.

Revision 1.4.2.2: download - view: text, markup, annotated - select for diffs
Fri May 16 02:23:27 2008 UTC (16 years, 7 months ago) by yamt
Branches: yamt-nfs-mp
Diff to: previous 1.4.2.1: preferred, colored; branchpoint 1.4: preferred, colored
Changes since revision 1.4.2.1: +453 -0 lines
sync with head.

Revision 1.4.4.1
Mon May 12 14:41:07 2008 UTC (16 years, 7 months ago) by yamt
Branches: yamt-pf42
FILE REMOVED
Changes since revision 1.4: +0 -453 lines
file cpu.h was added on branch yamt-pf42 on 2008-05-18 12:33:01 +0000

Revision 1.4.2.1
Mon May 12 14:41:07 2008 UTC (16 years, 7 months ago) by yamt
Branches: yamt-nfs-mp
FILE REMOVED
Changes since revision 1.4: +0 -453 lines
file cpu.h was added on branch yamt-nfs-mp on 2008-05-16 02:23:27 +0000

Revision 1.4: download - view: text, markup, annotated - select for diffs
Mon May 12 14:41:07 2008 UTC (16 years, 7 months ago) by ad
Branches: MAIN
CVS tags: yamt-pf42-base2, yamt-pf42-base, yamt-nfs-mp-base2, hpcarm-cleanup-nbase
Branch point for: yamt-pf42, yamt-nfs-mp
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +2 -4 lines
- Make cpu_number() return MI index, otherwise the pmap cannot work on
  systems with lapic IDs > X86_MAXPROCS.
- Kill cpu_info[] array and use MI cpu_lookup_byindex().

Revision 1.3: download - view: text, markup, annotated - select for diffs
Sun May 11 16:23:05 2008 UTC (16 years, 7 months ago) by ad
Branches: MAIN
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +2 -1 lines
Don't reload LDTR unless a new value, which only happens for USER_LDT.

Revision 1.2: download - view: text, markup, annotated - select for diffs
Sun May 11 15:59:50 2008 UTC (16 years, 7 months ago) by ad
Branches: MAIN
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +1 -2 lines
Stop using APIC IDs to identify CPUs for software purposes. Allows for
APIC IDs beyond 31, which has been possible for some time now.

Revision 1.1: download - view: text, markup, annotated - select for diffs
Sun May 11 15:32:20 2008 UTC (16 years, 7 months ago) by ad
Branches: MAIN
Share cpu.h between the x86 ports.

Diff request

This form allows you to request diffs between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.

Log view options

CVSweb <webmaster@jp.NetBSD.org>