Home | History | Annotate | only in /src/sys/arch/xen/conf
History log of /src/sys/arch/xen/conf
RevisionDateAuthorComments
 1.25 09-Mar-2005  bouyer Merge the bouyer-xen2 branch. This add supports for the Xen 2.0 virtual
machine kernel (both privileged and non-privileged domains), and remove support
for the old xen 1.2.
 1.24 25-Feb-2005  simonb Add COMPAT_20 (and COMPAT_16 in some cases) to kernel config files
that didn't have those options but had other earlier compat options.
 1.23 18-Feb-2005  dsl Invert FFS_SNAPSHOT to FFS_NO_SNAPSHOT
 1.22 11-Feb-2005  dsl Add 'option FFS_SNAPSHOT' to most of the config files.
Commented out for kernels that appear to hace space constraints.
 1.21 31-Jan-2005  hannken Add file system snapshots to kernel configs.

- Ffs internal snapshots get compiled in unconditionally.

- File system snapshot device fss(4) added to all kernel configs that
have a disk. Device is commented out on all non-GENERIC kernels.

Reviewed by: Jason Thorpe <thorpej@netbsd.org>
 1.20 28-Jan-2005  rumble Sprinkle options UFS_DIRHASH on GENERIC kernels. It's presently
commented out and labeled experimental pending further review and
testing.
 1.19 17-Jan-2005  cube branches: 1.19.2;
Add tap(4) support to a random^Wcarefully chosen set of kernel configs.
All those kernels have a line for both tun and bridge, and if either is
commented out, tap is commented out also. With the exception of i386's
GENERIC_TINY.

XXX: we _need_ some way of making this more simple.
 1.18 10-Nov-2004  christos branches: 1.18.4; 1.18.6;
Add COMPAT_BSDPTY to the rest of the config files.
 1.17 10-Nov-2004  christos Add COMPAT_BSDPTY on all the kernels that have COMPAT options.
 1.16 23-Sep-2004  tls Changes from Christian Limpach to improve timekeeping on NetBSD/xen by
actually adjusting the time correctly (calling hardclock as needed, not
just blindly every time Xen schedules us) based on Xen's idea of the
time in the shared page.

Xen source repo change info:
ChangeSet
2004/09/22 13:47:22+01:00 cl349@freefall.cl.cam.ac.uk
Fix time.

netbsd-2.0-xen-sparse/sys/arch/xen/xen/clock.c
2004/09/22 13:47:21+01:00 cl349@freefall.cl.cam.ac.uk +28 -3
Don't call hardclock on spurious timer interrupt and call hardclock
for missed interrupts.

netbsd-2.0-xen-sparse/sys/arch/xen/conf/XEN
2004/09/22 13:47:21+01:00 cl349@freefall.cl.cam.ac.uk +0 -1
Don't need custom HZ value any longer.

: ----------------------------------------------------------------------
 1.15 04-Sep-2004  manu IPv4 PIM support, based on a submission from Pavlin Radoslavov posted on
tech-net@
 1.14 15-Jul-2004  atatat branches: 1.14.2;
Add "options SYSCTL_INCLUDE_DESCR" to a lot of configs, but commented
out in most of them.
 1.13 26-Jun-2004  abs Add (commented out) ALTQ options to all GENERIC-like files
 1.12 18-Jun-2004  christos ptm is now mandatory, depends on pty, and can be disabled with -DNO_DEV_PTM
 1.11 16-Jun-2004  christos Add pseudo-device ptm on all the generic flavored kernels.
 1.10 07-May-2004  cl Add support for domain0 operations:
- access to all physical memory
- access to hypervisor traps from userland
- setup/config Xen's network routing/firewall rules
 1.9 26-Apr-2004  cl Add mouse support.
 1.8 24-Apr-2004  cl Enable keyboard and vga display as console when running as domain-0.
 1.7 24-Apr-2004  cl Add keyboard support and wscons config options.
 1.6 24-Apr-2004  cl Add vga display support.
 1.5 24-Apr-2004  cl Allow the block device driver to impersonate wd/sd/cd devices. This allows
for most system seamless migration from a NetBSD/i386 setup to a NetBSD/xen
setup without changing /etc/fstab or creating additional device nodes.
 1.4 24-Apr-2004  cl Consistently use xencons for eveything reffering to Xen's virtual console.

rename arch/xen/xen/console.c -> arch/xen/xen/xencons.c
 1.3 24-Apr-2004  cl Add ``hypervisor at mainbus'' and attach all devices provided by the
hypervisor to it instead of mainbus.

rename arch/xen/i386/hypervisor.c -> arch/xen/i386/hypervisor_machdep.c
 1.2 17-Apr-2004  cl add block device driver
 1.1 11-Mar-2004  cl branches: 1.1.2;
Add port to the Xen virtual machine monitor.
(see http://www.cl.cam.ac.uk/Research/SRG/netos/xen/)
 1.1.2.5 11-Aug-2007  bouyer Pull up following revision(s) (requested by adrianp in ticket #11356):
sys/arch/acorn32/conf/GENERIC 1.80 via patch
sys/arch/amd64/conf/GENERIC 1.154 via patch
sys/arch/amiga/conf/GENERIC.in 1.61 via patch
sys/arch/arc/conf/GENERIC 1.148 via patch
sys/arch/atari/conf/GENERIC.in 1.68 via patch
sys/arch/cats/conf/GENERIC 1.116 via patch
sys/arch/hp300/conf/GENERIC 1.141 via patch
sys/arch/hp700/conf/GENERIC patch
sys/arch/i386/conf/GENERIC 1.840 via patch
sys/arch/i386/conf/GENERIC_LAPTOP 1.239 via patch
sys/arch/i386/conf/GENERIC.MPACPI patch
sys/arch/mac68k/conf/GENERIC 1.182 via patch
sys/arch/sgimips/conf/GENERIC32_IP2x 1.68 via patch
sys/arch/sgimips/conf/GENERIC32_IP3x 1.66 via patch
sys/arch/sparc/conf/GENERIC 1.200 via patch
sys/arch/sparc64/conf/GENERIC32 patch
sys/arch/xen/conf/GENERIC patch
Remove iso(4) from GENERIC kernels, as discussed on tech-net@
Ok'ed by core@
 1.1.2.4 23-Sep-2004  jmc branches: 1.1.2.4.2; 1.1.2.4.4;
Pullup rev 1.16 (requested by tls in ticket #871)

Changes to improve timekeeping on NetBSD/xen by actually adjusting the time
correctly (calling hardclock as needed, not just blindly every time Xen
schedules us) based on Xens idea of the time in the shared page.
 1.1.2.3 15-Jul-2004  he Pull up revision 1.14 (requested by atatat in ticket #663):
Add "options SYSCTL_INCLUDE_DESCR" to a lot of configurations,
but commented out in most of them.
 1.1.2.2 30-Jun-2004  jdc Pull up revision 1.13 (requested by abs in ticket #567).

Add (commented out) ALTQ options to all GENERIC-like files
 1.1.2.1 22-May-2004  he Pull up revisions 1.2-1.10 (requested by cl in ticket #337):
Upgrade xen support:
- add block device driver
- network device driver bug fixes
- support for vga/keyboard/mouse
- support for domain0 operations
- fix /dev/mem and i386_iopl, reboot, event dispatch
- fix clock support, cpu speed report, lazy fpu switching
- add xen12load loader
- sys/arch/xen parts of build.sh release support
[cl, ticket #337]
 1.1.2.4.4.1 11-Aug-2007  bouyer Pull up following revision(s) (requested by adrianp in ticket #11356):
sys/arch/acorn32/conf/GENERIC 1.80 via patch
sys/arch/amd64/conf/GENERIC 1.154 via patch
sys/arch/amiga/conf/GENERIC.in 1.61 via patch
sys/arch/arc/conf/GENERIC 1.148 via patch
sys/arch/atari/conf/GENERIC.in 1.68 via patch
sys/arch/cats/conf/GENERIC 1.116 via patch
sys/arch/hp300/conf/GENERIC 1.141 via patch
sys/arch/hp700/conf/GENERIC patch
sys/arch/i386/conf/GENERIC 1.840 via patch
sys/arch/i386/conf/GENERIC_LAPTOP 1.239 via patch
sys/arch/i386/conf/GENERIC.MPACPI patch
sys/arch/mac68k/conf/GENERIC 1.182 via patch
sys/arch/sgimips/conf/GENERIC32_IP2x 1.68 via patch
sys/arch/sgimips/conf/GENERIC32_IP3x 1.66 via patch
sys/arch/sparc/conf/GENERIC 1.200 via patch
sys/arch/sparc64/conf/GENERIC32 patch
sys/arch/xen/conf/GENERIC patch
Remove iso(4) from GENERIC kernels, as discussed on tech-net@
Ok'ed by core@
 1.1.2.4.2.1 11-Aug-2007  bouyer Pull up following revision(s) (requested by adrianp in ticket #11356):
sys/arch/acorn32/conf/GENERIC 1.80 via patch
sys/arch/amd64/conf/GENERIC 1.154 via patch
sys/arch/amiga/conf/GENERIC.in 1.61 via patch
sys/arch/arc/conf/GENERIC 1.148 via patch
sys/arch/atari/conf/GENERIC.in 1.68 via patch
sys/arch/cats/conf/GENERIC 1.116 via patch
sys/arch/hp300/conf/GENERIC 1.141 via patch
sys/arch/hp700/conf/GENERIC patch
sys/arch/i386/conf/GENERIC 1.840 via patch
sys/arch/i386/conf/GENERIC_LAPTOP 1.239 via patch
sys/arch/i386/conf/GENERIC.MPACPI patch
sys/arch/mac68k/conf/GENERIC 1.182 via patch
sys/arch/sgimips/conf/GENERIC32_IP2x 1.68 via patch
sys/arch/sgimips/conf/GENERIC32_IP3x 1.66 via patch
sys/arch/sparc/conf/GENERIC 1.200 via patch
sys/arch/sparc64/conf/GENERIC32 patch
sys/arch/xen/conf/GENERIC patch
Remove iso(4) from GENERIC kernels, as discussed on tech-net@
Ok'ed by core@
 1.14.2.11 01-Apr-2005  skrll Sync with HEAD.
 1.14.2.10 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.14.2.9 15-Feb-2005  skrll Sync with HEAD.
 1.14.2.8 04-Feb-2005  skrll Sync with HEAD.
 1.14.2.7 24-Jan-2005  skrll Sync with HEAD.
 1.14.2.6 14-Nov-2004  skrll Sync with HEAD.
 1.14.2.5 24-Sep-2004  skrll Sync with HEAD.
 1.14.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.14.2.2 03-Aug-2004  skrll Sync with HEAD
 1.14.2.1 15-Jul-2004  skrll file GENERIC was added on branch ktrace-lwp on 2004-08-03 10:43:10 +0000
 1.18.6.1 29-Apr-2005  kent sync with -current
 1.18.4.1 09-Mar-2005  bouyer out of date; use XEN0 or XEN.
 1.19.2.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.19.2.1 12-Feb-2005  yamt sync with head.
 1.2 09-Mar-2005  bouyer Merge the bouyer-xen2 branch. This add supports for the Xen 2.0 virtual
machine kernel (both privileged and non-privileged domains), and remove support
for the old xen 1.2.
 1.1 11-Mar-2004  cl branches: 1.1.4; 1.1.8; 1.1.12; 1.1.14;
Add port to the Xen virtual machine monitor.
(see http://www.cl.cam.ac.uk/Research/SRG/netos/xen/)
 1.1.14.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.1.12.1 29-Apr-2005  kent sync with -current
 1.1.8.1 09-Mar-2005  bouyer out of date; use XEN0 or XEN.
 1.1.4.5 01-Apr-2005  skrll Sync with HEAD.
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 11-Mar-2004  skrll file GENERIC.local was added on branch ktrace-lwp on 2004-08-03 10:43:10 +0000
 1.3 22-Nov-2007  bouyer Pull up the bouyer-xenamd64 branch to HEAD. This brings in amd64 support
to NetBSD/Xen, both Dom0 and DomU.
 1.2 11-Dec-2005  christos branches: 1.2.30; 1.2.48; 1.2.50; 1.2.54; 1.2.56;
merge ktrace-lwp.
 1.1 12-May-2004  cl branches: 1.1.2; 1.1.4; 1.1.18;
``build.sh -m xen-i386 release'' now builds a release for NetBSD/xen
for i386. The resulting release consists of:
- NetBSD/xen for i386 kernel, loader and docuemntation
- NetBSD/i386 userland sets
 1.1.18.1 07-Dec-2007  yamt sync with head
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 12-May-2004  skrll file Makefile.arch.inc was added on branch ktrace-lwp on 2004-08-03 10:43:10 +0000
 1.1.2.2 22-May-2004  he Pull up revision 1.1 (requested by cl in ticket #337):
Upgrade xen support:
- add block device driver
- network device driver bug fixes
- support for vga/keyboard/mouse
- support for domain0 operations
- fix /dev/mem and i386_iopl, reboot, event dispatch
- fix clock support, cpu speed report, lazy fpu switching
- add xen12load loader
- sys/arch/xen parts of build.sh release support
[cl, ticket #337]
 1.1.2.1 12-May-2004  he file Makefile.arch.inc was added on branch netbsd-2-0 on 2004-05-22 15:59:21 +0000
 1.2.56.1 08-Dec-2007  mjf Sync with HEAD.
 1.2.54.2 19-Nov-2007  bouyer Get rid of arch/xenamd64, step 1: empty xenamd64/conf
- move xenamd64/conf/std.xen to amd64/conf/
- define arch to amd64 amd64/conf/std.xen, and i386 in xen/conf/std.xen
(machine is xen)
- enclose content of amd64/conf/files.amd64 and i386/conf/files.i386 in
ifndef xen/endif, so it can be transparently inclued for xen kernels
- support MACHINE_ARCH=x86_64 in xen/conf/Makefile*
 1.2.54.1 17-Oct-2007  bouyer Prepare for xenamd64:
- kill xen/i386/identcpu.c, use i386/i386/identcpu.c instead (with a few
#ifndef XEN)
- move some files that can be shared between i386 and amd64 from
xen/i386 to xen/x86 (or to xen/xen for non-cpu-specific code)
- split assembly out of xen/include/hypervisor.h to xen/include/hypercalls.h
- use <xen/...> instead of <machine/...> for cpu-independant include files.

more work needed here, i386-specific files should got out of arch/xen to
arch/xeni386, and more code shared with arch/i386.
 1.2.50.1 09-Jan-2008  matt sync with HEAD
 1.2.48.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.2.30.1 03-Dec-2007  ad Sync with HEAD.
 1.50 02-May-2020  bouyer 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().
 1.49 25-Apr-2020  bouyer 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
 1.48 02-Feb-2019  cherry branches: 1.48.10;
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/
 1.47 22-Sep-2018  rin - Determine KERN_AS automatically depending on whether OPT_MODULAR is
set or not, in the same way as libcompat.

- Specify OPT_MODULAR in the port Makefile instead of KERN_AS.

Now, KERN_AS=library is used for kernels without module(7) for all ports.

OK christos
 1.46 02-Jun-2018  christos branches: 1.46.2;
disable sanitizers and relro
 1.45 21-Jan-2018  maxv branches: 1.45.2;
Fix the build, on Xen too amd64_trap.S needs to be compiled independently.
 1.44 12-Dec-2017  pgoyette Remove trailing '&&' from shell script to fix the build.

From a-rin on https://gist.github.com/a-rin/940abb80d45eb7ac75b8110b8466f149
 1.43 10-Dec-2017  christos - Allow multiple .BEGIN targets
- Make their protection consistent
 1.42 09-Aug-2017  maxv Remove several dead entries from the x86 makefiles. Looks like people (me
included) regularly forget to take care of this.
 1.41 02-Feb-2017  maxv branches: 1.41.6;
Increase KERNTEXTOFF from 1MB to 2MB on amd64. [1MB; 2MB[ is now handled
by UVM, so there is no physical loss.

On amd64 we always remap the kernel text with 2MB pages, and because of the
1MB start address we were forced to map [0MB; 2MB[ inside the first large
page. The problem is, the lower half is used by UVM to allocate physical
pages, and it is possible that some of these could be used by userland. We
could end up with userland-controllable data mapped into the kernel text on
a privileged page, which is far from being a good idea from a security pov.

I am not fixing i386 yet, because the large page size depends on PAE, and
we probably don't want to have a text located at 4MB on low-memory systems.

(note: I didn't introduce this issue, it was already there when I came in)
 1.40 24-Aug-2015  uebayasi branches: 1.40.2; 1.40.4;
Define ${LINKSCRIPT} in one place.
 1.39 18-Aug-2015  uebayasi ${KERN_LDSCRIPT} -> ${KERNLDSCRIPT}
 1.38 15-Nov-2014  uebayasi branches: 1.38.2;
Use LINKSCRIPT.
 1.37 20-Jul-2014  joerg Restrict -mno-fp-ret-in-387 to GCC.
 1.36 17-Jul-2014  bouyer Sync DEFCOPTS and CFLAGS with i386 and amd64 counterparts.
Especially -fno-omit-frame-pointer
 1.35 19-Dec-2011  joerg branches: 1.35.6; 1.35.20;
Move Clang-warning flags for ah_regdomain.c into sys/conf, they are
platform independent. Use the selective -Wno-* flags instead of
-Wno-error.
 1.34 17-Aug-2011  joerg branches: 1.34.2; 1.34.6;
Works with clang's integrated assembler now.
 1.33 30-May-2011  joerg Disable -Werror for ah_regdomain.c if building with clang as workaround
for http://llvm.org/bugs/show_bug.cgi?id=10030.
 1.32 20-May-2011  joerg LLVM's assembler parser doesn't support .code32 yet, so disable it as
needed.
 1.31 12-Jan-2011  joerg branches: 1.31.2;
Allow use of traditional CPP to be set on a per platform base in sys.mk.
Honour this for dependency processing in bsd.dep.mk. Switch i386 and
amd64 assembly to use ISO C90 preprocessor concat and drop the
-traditional-cpp on this platform.
 1.30 06-Jul-2010  mrg remove almost all the ability to build netbsd with an a.out target.
we're ELF now, and there are many missing checks against OBJECT_FMT.
if we ever consider switching, the we can figure out what new ones
we need but for now it's just clutter.

this doesn't remove any of the support for exec_aout or any actually
required-for-boot a.out support, only the ability to build a netbsd
release in a.out format. ie, most of this code has been dead for
over a decade.

i've tested builds on vax, amd64, i386, mac68k, macppc, sparc, atari,
amiga, shark, cats, dreamcast, landisk, mmeye and x68k. this covers
the 5 MACHINE_ARCH's affected, and all the other arch code touched.
it also includes some actual run-time testing of sparc, i386 and
shark, and i performed binary comparison upon amiga and x68k as well.


some minor details relevant:
- move shlib.[ch] from ld.aout_so into ldconfig proper, and cut them
down to only the parts ldconfig needs
- remove various unused source files
- switch amiga bootblocks to using elf2bb.h instead of aout2bb.h
 1.29 25-Nov-2009  tron branches: 1.29.2; 1.29.4;
Enable SSP (Stack Smash Protection) in x86 kernels by default (except
in i386 *TINY kernels). The NetBSD/i386 "ALL" kernel is unconditionally
compiled with SSP enabled.

Change approved by the core team.
 1.28 11-Dec-2008  alc branches: 1.28.2;
Clean-up makefile stub used to include in the build the binary HAL object
 1.27 30-Oct-2008  joerg branches: 1.27.2; 1.27.8;
New assym.h dependency.
 1.26 25-Jan-2008  joerg branches: 1.26.6; 1.26.10; 1.26.16; 1.26.18;
Refactor in_cksum/in4_cksum/in6_cksum implementations:
- All three functions are included in the kernel by default.
They call a backend function cpu_in_cksum after possibly
computing the checksum of the pseudo header.
- cpu_in_cksum is the core to implement the one-complement sum.
The default implementation is moderate fast on most platforms
and provides a 32bit accumulator with 16bit addends for L32 platforms
and a 64bit accumulator with 32bit addends for L64 platforms.
It handles edge cases like very large mbuf chains (could happen with
native IPv6 in the future) and provides a good base for new native
implementations.
- Modify i386 and amd64 assembly to use the new interface.

This disables the MD implementations on !x86 until the conversion is
done. For Alpha, the portable version is faster.
 1.25 17-Jan-2008  lukem Remove unnecessary references to config_time.h.
 1.24 11-Jan-2008  bouyer Merge the bouyer-xeni386 branch to head, at tag bouyer-xeni386-merge1 (the
branch is still active and will see i386PAE support developement).
Sumary of changes:
- switch xeni386 to the x86/x86/pmap.c, and the xen/x86/x86_xpmap.c
pmap bootstrap.
- merge back most of xen/i386/ to i386/i386
- change the build to reduce diffs between i386 and amd64 in file locations
- remove include files that were identical to the i386/amd64 counterparts,
the build will find them via the xen-ma/machine link.
 1.23 03-Jan-2008  joerg Add assym.h dependency.
 1.22 02-Jan-2008  joerg Add some missing dependencies on assym.h.
 1.21 01-Jan-2008  yamt add some dependencies on assym.h.
 1.20 22-Nov-2007  bouyer branches: 1.20.6;
Pull up the bouyer-xenamd64 branch to HEAD. This brings in amd64 support
to NetBSD/Xen, both Dom0 and DomU.
 1.19 09-Feb-2007  ad branches: 1.19.6; 1.19.22; 1.19.24; 1.19.28; 1.19.30;
Merge newlock2 to head.
 1.18 28-May-2006  pavel branches: 1.18.6;
Give Xen its own linker script, which does not set the physical load address
specially. In Xen, the system is already in virtual mode when the kernel is
started, so the old behavior of setting physical address to virtual address
was actually correct, and the previous change made NetBSD/Xen kernels
unbootable.

Pointed out, explained and tested by <bouyer>.
 1.17 14-May-2006  elad branches: 1.17.2;
integrate kauth.
 1.16 04-Apr-2006  gdamore Convert existing ath users to new Makefile, except for amd64, which needs
the rules due to needing to conditionally postprocess the HAL object file.

Macppc needs a a non-ELF HAL (EABI) object, so take care of that by default
in the atheros include file.
 1.15 02-Apr-2006  gdamore Reorganize ath layout as requested by sam@ and suggested by dyoung@ in
http://mail-index.netbsd.org/tech-net/2006/03/15/0000.html.

The new layout almost precisely matches FreeBSD, and should make
future imports much easier.

At the same time, import the current 0.9.16.16 HAL from FreeBSD. According
to sam@, this is the proper version we should be using.
 1.14 08-Mar-2006  dyoung branches: 1.14.2;
config(8) creates opt_ah.h, no need to do so here.
 1.13 03-Mar-2006  he branches: 1.13.2; 1.13.4;
Before symlinking opt_ah.h, make sure the target doesn't already exist.
This fixes a build problem with UPDATE set.
 1.12 11-Dec-2005  christos branches: 1.12.4; 1.12.6;
merge ktrace-lwp.
 1.11 08-Nov-2005  yamt copy.S should belong to MD_SFILES, not MD_CFILES.
 1.10 07-Nov-2005  yamt some assym cleanup.
- move copyin and friends from locore.S to their own file, copy.S.
share it between i386 and xen.
- defparam KERNBASE and kill KERNBASE_LOCORE hack.
- add more symbols to assym.h and use it where appropriate.
 1.9 22-Jun-2005  dyoung branches: 1.9.2;
Resolve conflicts in importation of 18-May-2005 ath(4) / net80211(9)
from FreeBSD. Introduce compatibility shims (sys/dev/ic/ath_netbsd.[ch],
sys/net80211/ieee80211_netbsd.[ch]). Update drivers (an, atu, atw,
awi, ipw, iwi, rtw, wi) for the new net80211(9) API.
 1.8 19-Jun-2005  chs copy the athhal glue from Makefile.i386.
 1.7 07-Jun-2005  sjg Sometimes .BEGIN target is not wanted - eg in sub-make's.
 1.6 31-May-2005  christos s/GENASSYM/GENASSYM_CONF/ so we can use "GENASSYM" as the program name.
 1.5 21-Jun-2004  jmc branches: 1.5.2; 1.5.14;
Ignore errors on some rm -rf's for platforms that aren't quite
POSIX compliant
and return errors on r/o source (FreeBSD) for -rf. Fixes PR#25022
 1.4 04-Jun-2004  thorpej Add the %MAKEOPTIONSAPPEND token at the end of the file, after the
common Makefile.kern.inc has been included.
 1.3 14-May-2004  cl use relative links: using $S fails if $S is relative to another dir
than the one where it's used
 1.2 12-May-2004  cl ``build.sh -m xen-i386 release'' now builds a release for NetBSD/xen
for i386. The resulting release consists of:
- NetBSD/xen for i386 kernel, loader and docuemntation
- NetBSD/i386 userland sets
 1.1 11-Mar-2004  cl branches: 1.1.2;
Add port to the Xen virtual machine monitor.
(see http://www.cl.cam.ac.uk/Research/SRG/netos/xen/)
 1.1.2.2 22-Jun-2004  tron branches: 1.1.2.2.2;
Pull up revision 1.5 (requested by jmc in ticket #531):
Ignore errors on some rm -rf's for platforms that aren't quite
POSIX compliant
and return errors on r/o source (FreeBSD) for -rf. Fixes PR#25022
 1.1.2.1 22-May-2004  he Pull up revisions 1.2-1.3 (requested by cl in ticket #337):
Upgrade xen support:
- add block device driver
- network device driver bug fixes
- support for vga/keyboard/mouse
- support for domain0 operations
- fix /dev/mem and i386_iopl, reboot, event dispatch
- fix clock support, cpu speed report, lazy fpu switching
- add xen12load loader
- sys/arch/xen parts of build.sh release support
[cl, ticket #337]
 1.1.2.2.2.1 06-Feb-2005  jmc Pull up patch (requested by martti in ticket #1086)
Move ipf to sys/dist/ipf and sync w. trunk
 1.5.14.1 29-Mar-2006  tron Apply patch (requested by bouyer in ticket #1231):
Add support for ath at pci for XEN domain0.
 1.5.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.5.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.5.2.2 03-Aug-2004  skrll Sync with HEAD
 1.5.2.1 21-Jun-2004  skrll file Makefile.xen was added on branch ktrace-lwp on 2004-08-03 10:43:10 +0000
 1.9.2.5 04-Feb-2008  yamt sync with head.
 1.9.2.4 21-Jan-2008  yamt sync with head
 1.9.2.3 07-Dec-2007  yamt sync with head
 1.9.2.2 26-Feb-2007  yamt sync with head.
 1.9.2.1 21-Jun-2006  yamt sync with head.
 1.12.6.2 01-Jun-2006  kardel Sync with head.
 1.12.6.1 22-Apr-2006  simonb Sync with head.
 1.12.4.1 09-Sep-2006  rpaulo sync with head
 1.13.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.13.2.3 26-Jun-2006  yamt sync with head.
 1.13.2.2 11-Apr-2006  yamt sync with head
 1.13.2.1 13-Mar-2006  yamt sync with head.
 1.14.2.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.17.2.1 19-Jun-2006  chap Sync with head.
 1.18.6.1 28-Jan-2007  ad xen MD changes.
 1.19.30.2 18-Feb-2008  mjf Sync with HEAD.
 1.19.30.1 08-Dec-2007  mjf Sync with HEAD.
 1.19.28.2 19-Nov-2007  bouyer Get rid of arch/xenamd64, step 2: move xenamd64/include to xen/include/amd64
 1.19.28.1 19-Nov-2007  bouyer Get rid of arch/xenamd64, step 1: empty xenamd64/conf
- move xenamd64/conf/std.xen to amd64/conf/
- define arch to amd64 amd64/conf/std.xen, and i386 in xen/conf/std.xen
(machine is xen)
- enclose content of amd64/conf/files.amd64 and i386/conf/files.i386 in
ifndef xen/endif, so it can be transparently inclued for xen kernels
- support MACHINE_ARCH=x86_64 in xen/conf/Makefile*
 1.19.24.2 23-Mar-2008  matt sync with HEAD
 1.19.24.1 09-Jan-2008  matt sync with HEAD
 1.19.22.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.19.6.1 03-Dec-2007  ad Sync with HEAD.
 1.20.6.7 19-Jan-2008  bouyer Sync with HEAD
 1.20.6.6 10-Jan-2008  bouyer Change xeni386 build to match xenamd64:
- machine/ points to xen/include/i386
- remove includes that were identical to the i386/include/ ones; the build
will find them though the xen-ma/machine link.
- include xen files using xen/ not machine/
 1.20.6.5 09-Jan-2008  bouyer Merge Xen suport in i386/i386/spl.S.
 1.20.6.4 09-Jan-2008  bouyer Merge Xen support back to i386/i386/vector.S
 1.20.6.3 08-Jan-2008  bouyer Sync with HEAD
 1.20.6.2 06-Jan-2008  bouyer Merge needed changes to genassym.cf and locore.S for xeni386 back to
arch/i386. Switch xeni386 to use the arch/i386 cpu.h.
 1.20.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.26.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.26.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.26.10.3 11-Aug-2010  yamt sync with head.
 1.26.10.2 11-Mar-2010  yamt sync with head
 1.26.10.1 04-May-2009  yamt sync with head.
 1.26.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.27.8.1 21-Apr-2010  matt sync to netbsd-5
 1.27.2.1 07-Aug-2009  snj Pull up following revision(s) (requested by sborrill in ticket #905):
sys/arch/alpha/conf/Makefile.alpha: revision 1.81
sys/arch/amd64/conf/Makefile.amd64: revision 1.26
sys/arch/i386/conf/Makefile.i386: revision 1.162
sys/arch/macppc/conf/Makefile.macppc: revision 1.31
sys/arch/mips/conf/Makefile.mips: revision 1.52
sys/arch/sparc64/conf/Makefile.sparc64: revision 1.68
sys/arch/xen/conf/Makefile.xen: revision 1.28
Clean-up makefile stub used to include in the build the binary HAL object
 1.28.2.3 27-Aug-2011  jym Sync with HEAD. Most notably: uvm/pmap work done by rmind@, and MP Xen
work of cherry@.

No regression observed on suspend/restore.
 1.28.2.2 28-Mar-2011  jym 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.
 1.28.2.1 24-Oct-2010  jym Sync with HEAD
 1.29.4.2 31-May-2011  rmind sync with head
 1.29.4.1 05-Mar-2011  rmind sync with head
 1.29.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.31.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.34.6.1 18-Feb-2012  mrg merge to -current.
 1.34.2.1 17-Apr-2012  yamt sync with head
 1.35.20.1 10-Aug-2014  tls Rebase.
 1.35.6.2 03-Dec-2017  jdolecek update from HEAD
 1.35.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.38.2.3 28-Aug-2017  skrll Sync with HEAD
 1.38.2.2 05-Feb-2017  skrll Sync with HEAD
 1.38.2.1 22-Sep-2015  skrll Sync with HEAD
 1.40.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.40.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.41.6.1 07-Mar-2018  martin Pull up the following revisions (via patch), requested by maxv in ticket #610:

sys/arch/amd64/amd64/amd64_trap.S 1.8,1.10,1.12 (partial),1.13-1.15,
1.19 (partial),1.20,1.21,1.22,1.24
(via patch)
sys/arch/amd64/amd64/locore.S 1.129 (partial),1.132 (via patch)
sys/arch/amd64/amd64/trap.c 1.97 (partial),1.111 (via patch)
sys/arch/amd64/amd64/vector.S 1.54,1.55 (via patch)
sys/arch/amd64/include/frameasm.h 1.21,1.23 (via patch)
sys/arch/x86/x86/cpu.c 1.138 (via patch)
sys/arch/xen/conf/Makefile.xen 1.45 (via patch)

Rename and reorder several things in amd64_trap.S.
Compile amd64_trap.S as a file.
Introduce nmitrap and doubletrap.
Have the CPU clear PSL_D automatically in the syscall entry point.
 1.45.2.2 30-Sep-2018  pgoyette Ssync with HEAD
 1.45.2.1 25-Jun-2018  pgoyette Sync with HEAD
 1.46.2.1 10-Jun-2019  christos Sync with HEAD
 1.48.10.1 16-Apr-2020  bouyer Reorganise sources to make it possible to include Xen PVHVM support in
native kernels. Among others:
- move xen/include/amd64/hypercall.h to amd64/include/xen and
xen/include/i386/hypercall.h to i386/include/xen
- exclude some native files from the build for xenpv
- add xen to "machine" config statement for amd64 and i386
- split arch/xen/conf/files.xen to arch/xen/conf/files.xen (for pv drivers)
and arch/xen/conf/files.xen.pv (for full pv support)
- add GENERIC_XENHVM kernel config which includes GENERIC and add Xen PV
drivers.
 1.21 11-Mar-2005  bouyer Move Xen kernel config files to arch/i386, so that they can be added to
the i386 release process. Make them include archi/i386/conf/GENERIC.local,
like other i386 GENERIC and INSTALL files.
 1.20 09-Mar-2005  xtraeme Now that GENERIC* kernels are removed, remove references.
 1.19 09-Mar-2005  bouyer Merge the bouyer-xen2 branch. This add supports for the Xen 2.0 virtual
machine kernel (both privileged and non-privileged domains), and remove support
for the old xen 1.2.
 1.18 25-Feb-2005  simonb Add COMPAT_20 (and COMPAT_16 in some cases) to kernel config files
that didn't have those options but had other earlier compat options.
 1.17 18-Feb-2005  dsl Add FFS_NO_SNAPSHOT - commented out in XEN
 1.16 31-Jan-2005  hannken Add file system snapshots to kernel configs.

- Ffs internal snapshots get compiled in unconditionally.

- File system snapshot device fss(4) added to all kernel configs that
have a disk. Device is commented out on all non-GENERIC kernels.

Reviewed by: Jason Thorpe <thorpej@netbsd.org>
 1.15 17-Jan-2005  cube branches: 1.15.2;
Add tap(4) support to a random^Wcarefully chosen set of kernel configs.
All those kernels have a line for both tun and bridge, and if either is
commented out, tap is commented out also. With the exception of i386's
GENERIC_TINY.

XXX: we _need_ some way of making this more simple.
 1.14 10-Nov-2004  christos branches: 1.14.4; 1.14.6;
Add COMPAT_BSDPTY to the rest of the config files.
 1.13 23-Sep-2004  tls Changes from Christian Limpach to improve timekeeping on NetBSD/xen by
actually adjusting the time correctly (calling hardclock as needed, not
just blindly every time Xen schedules us) based on Xen's idea of the
time in the shared page.

Xen source repo change info:
ChangeSet
2004/09/22 13:47:22+01:00 cl349@freefall.cl.cam.ac.uk
Fix time.

netbsd-2.0-xen-sparse/sys/arch/xen/xen/clock.c
2004/09/22 13:47:21+01:00 cl349@freefall.cl.cam.ac.uk +28 -3
Don't call hardclock on spurious timer interrupt and call hardclock
for missed interrupts.

netbsd-2.0-xen-sparse/sys/arch/xen/conf/XEN
2004/09/22 13:47:21+01:00 cl349@freefall.cl.cam.ac.uk +0 -1
Don't need custom HZ value any longer.

: ----------------------------------------------------------------------
 1.12 04-Sep-2004  manu IPv4 PIM support, based on a submission from Pavlin Radoslavov posted on
tech-net@
 1.11 15-Jul-2004  atatat branches: 1.11.2;
Add "options SYSCTL_INCLUDE_DESCR" to a lot of configs, but commented
out in most of them.
 1.10 07-May-2004  cl Add support for domain0 operations:
- access to all physical memory
- access to hypervisor traps from userland
- setup/config Xen's network routing/firewall rules
 1.9 26-Apr-2004  cl Add mouse support.
 1.8 24-Apr-2004  cl Enable keyboard and vga display as console when running as domain-0.
 1.7 24-Apr-2004  cl Add keyboard support and wscons config options.
 1.6 24-Apr-2004  cl Add vga display support.
 1.5 24-Apr-2004  cl Allow the block device driver to impersonate wd/sd/cd devices. This allows
for most system seamless migration from a NetBSD/i386 setup to a NetBSD/xen
setup without changing /etc/fstab or creating additional device nodes.
 1.4 24-Apr-2004  cl Consistently use xencons for eveything reffering to Xen's virtual console.

rename arch/xen/xen/console.c -> arch/xen/xen/xencons.c
 1.3 24-Apr-2004  cl Add ``hypervisor at mainbus'' and attach all devices provided by the
hypervisor to it instead of mainbus.

rename arch/xen/i386/hypervisor.c -> arch/xen/i386/hypervisor_machdep.c
 1.2 17-Apr-2004  cl add block device driver
 1.1 11-Mar-2004  cl branches: 1.1.2;
Add port to the Xen virtual machine monitor.
(see http://www.cl.cam.ac.uk/Research/SRG/netos/xen/)
 1.1.2.3 23-Sep-2004  jmc Pullup rev 1.13 (requested by tls in ticket #871)

Changes to improve timekeeping on NetBSD/xen by actually adjusting the time
correctly (calling hardclock as needed, not just blindly every time Xen
schedules us) based on Xens idea of the time in the shared page.
 1.1.2.2 15-Jul-2004  he Pull up revision 1.11 (requested by atatat in ticket #663):
Add "options SYSCTL_INCLUDE_DESCR" to a lot of configurations,
but commented out in most of them.
 1.1.2.1 22-May-2004  he Pull up revisions 1.2-1.10 (requested by cl in ticket #337):
Upgrade xen support:
- add block device driver
- network device driver bug fixes
- support for vga/keyboard/mouse
- support for domain0 operations
- fix /dev/mem and i386_iopl, reboot, event dispatch
- fix clock support, cpu speed report, lazy fpu switching
- add xen12load loader
- sys/arch/xen parts of build.sh release support
[cl, ticket #337]
 1.11.2.10 01-Apr-2005  skrll Sync with HEAD.
 1.11.2.9 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.11.2.8 04-Feb-2005  skrll Sync with HEAD.
 1.11.2.7 24-Jan-2005  skrll Sync with HEAD.
 1.11.2.6 14-Nov-2004  skrll Sync with HEAD.
 1.11.2.5 24-Sep-2004  skrll Sync with HEAD.
 1.11.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.11.2.2 03-Aug-2004  skrll Sync with HEAD
 1.11.2.1 15-Jul-2004  skrll file XEN was added on branch ktrace-lwp on 2004-08-03 10:43:10 +0000
 1.14.6.1 29-Apr-2005  kent sync with -current
 1.14.4.4 09-Mar-2005  bouyer partial sync of options and pseudo-devices with i386/conf/
 1.14.4.3 19-Jan-2005  bouyer We can't attach {cd,wd,sd} at hypervisor, this conflicts with scsipi.
 1.14.4.2 17-Dec-2004  bouyer Merge changes between 2.0 and -current:
XEN: up to 1.14
files.xen: 1.12 - 1.14
 1.14.4.1 13-Dec-2004  bouyer Commit files from netbsd-2.0-xen-sparse/sys/arch/xen in the Xen-2.0
distribution. These are the files modified from the 2.0 tree to get
NetBSD/xen working with Xen 2.
 1.15.2.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.15.2.1 12-Feb-2005  yamt sync with head.
 1.4 11-Mar-2005  bouyer Move Xen kernel config files to arch/i386, so that they can be added to
the i386 release process. Make them include archi/i386/conf/GENERIC.local,
like other i386 GENERIC and INSTALL files.
 1.3 09-Mar-2005  xtraeme Now that GENERIC* kernels are removed, remove references.
 1.2 09-Mar-2005  bouyer Merge the bouyer-xen2 branch. This add supports for the Xen 2.0 virtual
machine kernel (both privileged and non-privileged domains), and remove support
for the old xen 1.2.
 1.1 16-Feb-2005  bouyer branches: 1.1.2;
file XEN-INSTALL was initially added on branch bouyer-xen2.
 1.1.2.2 09-Mar-2005  bouyer partial sync of options and pseudo-devices with i386/conf/
 1.1.2.1 16-Feb-2005  bouyer A kernel config with root on md. Will be used to install NetBSD/xen on a
VBD on a existing xen setup. Also usefull for testing purposes, but for
now you have to mdsetimage a ramdisk by hand.
 1.4 11-Mar-2005  bouyer Move Xen kernel config files to arch/i386, so that they can be added to
the i386 release process. Make them include archi/i386/conf/GENERIC.local,
like other i386 GENERIC and INSTALL files.
 1.3 09-Mar-2005  xtraeme Now that GENERIC* kernels are removed, remove references.
 1.2 09-Mar-2005  bouyer Merge the bouyer-xen2 branch. This add supports for the Xen 2.0 virtual
machine kernel (both privileged and non-privileged domains), and remove support
for the old xen 1.2.
 1.1 18-Jan-2005  bouyer branches: 1.1.2;
file XEN0 was initially added on branch bouyer-xen2.
 1.1.2.5 09-Mar-2005  bouyer partial sync of options and pseudo-devices with i386/conf/
 1.1.2.4 08-Mar-2005  bouyer Add support for ISA bus.
Clean up console attachement, and add support for VGA/pckbc console.
Add support for USB devices, including USB audio (which means others audio
devices should work too)
Add some more generic options to XEN0.
 1.1.2.3 31-Jan-2005  bouyer First pieces of domain control operations:
- use an up to date xenio.h
- update privcmd.c for newer ioctls (incomplete, some just return an error for
now)
- add a /dev/xenevt pseudo-device, which provide to userland an interface to
xen events
Now xend starts, and basic xm commands (such as list) work.
 1.1.2.2 21-Jan-2005  bouyer Add siop, esiop and ahc.
 1.1.2.1 18-Jan-2005  bouyer A config file suitable for a domain0 guest OS.
 1.35 23-Feb-2024  andvar s/optionms/options/ in copy-pasted comment.
 1.34 23-Jun-2022  bouyer Don't override isadma defflag for Xen, now that isadma is built for Xen PV too.
While there, match amd64 mainbus and call isa_dmainit() before attaching acpi.

Fixes a panic at boot on some hardware with a floppy disk controller.
 1.33 25-Apr-2020  bouyer 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
 1.32 09-Dec-2018  mrg branches: 1.32.10;
remove XXXKALSR that became MI.
 1.31 13-Jul-2018  maxv Remove the X86PMC code I had written, replaced by tprof. Many defines
become unused in specialreg.h, so remove them. We don't want to add
defines all the time, there are countless PMCs on many generations, and
it's better to just inline the event/unit values.
 1.30 08-Jan-2018  maxv branches: 1.30.2; 1.30.4;
Make Xen compile again.
 1.29 08-Oct-2017  maxv KASLR: add workarounds to compute the bootinfo VAs (use the direct map),
and don't use large pages yet. Both will be fixed later.
 1.28 12-Aug-2017  maxv Remove vm86.

Pass 3.
 1.27 29-Jul-2017  maxv Remove the remaining parts of compat_oldboot.
 1.26 12-Jul-2017  maxv include opt_pmc.h
 1.25 13-Dec-2016  kamil branches: 1.25.8;
Torn down KSTACK_CHECK_DR0, i386-only feature to detect stack overflow

This feature was intended to detect stack overflow with CPU Debug Registers
(x86). It was never ported to other ports, neither amd64 and should be
adapted for SMP...

Currently there might be better ways to detect stack overflows like page
mapping protection. Since the number of Debug Registers is restricted
(4 on x86), torn it down completely.

This interface introduced helper functions for Debug Registers, they will
be replaced with the new <x86/dbregs.h> interface.

KSTACK_CHECK_DR0 was disabled by default and won't affect ordinary users.

Sponsored by <The NetBSD Foundation>
 1.24 03-Oct-2012  dsl branches: 1.24.14; 1.24.18;
Remove all references to KVM86.
It was only ever used by APMBIOS - and then only if an option was selected.
Probably didn't work well at all!
 1.23 18-Nov-2011  jmcneill branches: 1.23.10;
remove Xbox support
 1.22 03-Oct-2009  jmcneill branches: 1.22.12;
add dummy opt_via_c7temp.h, spotted by Andreas Gustafsson.
 1.21 05-Aug-2009  jym Add Intel SpeedStep and AMD PowerNow! support in Xen dom0. MSR operations
are now compiled in by default.

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

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

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

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

Commit requested by bouyer@.
 1.20 29-Jul-2009  cegger remove Xen2 support.
ok bouyer@
 1.19 19-Feb-2009  jmcneill vesabios is no more
 1.18 23-Jan-2008  bouyer branches: 1.18.10; 1.18.18; 1.18.20; 1.18.24; 1.18.28;
Merge the bouyer-xeni386 branch. This brings in PAE support to NetBSD xeni386
(domU only). PAE support is enabled by 'options PAE', see the new XEN3PAE_DOMU
and INSTALL_XEN3PAE_DOMU kernel config files.

See the comments in arch/i386/include/{pte.h,pmap.h} to see how it works.
In short, we still handle it as a 2-level MMU, with the second level page
directory being 4 pages in size. pmap switching is done by switching the
L2 pages in the L3 entries, instead of loading %cr3. This is almost required
by Xen, which handle the last L2 page (the one mapping 0xc0000000 - 0xffffffff)
in a very special way. But this approach should also work for native PAE
support if ever supported (in fact, the pmap should almost suport native
PAE, what's missing is bootstrap code in locore.S).
 1.17 16-Jan-2008  ad Remove options MATH_EMULATE.
 1.16 11-Jan-2008  bouyer Merge the bouyer-xeni386 branch to head, at tag bouyer-xeni386-merge1 (the
branch is still active and will see i386PAE support developement).
Sumary of changes:
- switch xeni386 to the x86/x86/pmap.c, and the xen/x86/x86_xpmap.c
pmap bootstrap.
- merge back most of xen/i386/ to i386/i386
- change the build to reduce diffs between i386 and amd64 in file locations
- remove include files that were identical to the i386/amd64 counterparts,
the build will find them via the xen-ma/machine link.
 1.15 22-Nov-2007  bouyer branches: 1.15.6;
Pull up the bouyer-xenamd64 branch to HEAD. This brings in amd64 support
to NetBSD/Xen, both Dom0 and DomU.
 1.14 05-Jan-2007  jmcneill branches: 1.14.6; 1.14.22; 1.14.24; 1.14.28; 1.14.30;
On the Xbox, prevent scanning past the first device on bus 1.
 1.13 01-Oct-2006  bouyer Map the ISA hole on Xen, which allows us to access the SMBios, which allows
us to find the IPMI address. Add IPMI support on Xen (commented out for now)
 1.12 28-Sep-2006  bouyer Add Xen3 support for ACPI and/or MPBIOS + IOAPIC. To help with this, physical
CPUs are now configured on mainbus only in dom0, and only to know about
their APIC id. virtual CPUs are attached to hypervisor as:
vcpu* at hypervisor?
and this is what's used as curcpu(). The kernel config files needs to be
updated for this, see XEN3_DOM0 or XEN3_DOMU for examples.
XEN3_DOM0 now has acpi, MPBIOS and ioapic by default.
Note that a Xen dom0 kernel doens't have access to the lapic.
 1.11 09-Apr-2006  bouyer branches: 1.11.8; 1.11.10;
Add support for ACPI in xen-3 dom0 support. We can now boot a xen-3 dom0
kernel with a default xen comamnd line.
 1.10 15-Jan-2006  bouyer branches: 1.10.2; 1.10.4; 1.10.6; 1.10.8; 1.10.10;
Snapshot of work in progress on NetBSD port to Xen3:
- kernel (both dom0 and domU) boot, console is functionnal and it can starts
software from a ramdisk
- there is no driver front-end expect console for domU yet.
- dom0 can probe devices and ex(4) work when Xen3 is booted without acpi
and apic support. But the on-board IDE doens't get interrupts.
The PCI code still needs work (it's hardcoded to mode 1). Some of this
code should be shared with ../x86
The physical insterrupt code needs to get MPBIOS and ACPI support, and
do interrupt routing to properly interract with Xen.
To enable Xen-3.0 support, add
options XEN3
to your kernel config file (this will disable Xen2 support)
Changes affecting Xen-2.0 support (no functionnal changes intended):
- get more constants from genassym for assembly code
- remove some unneeded registers move from start()
- map the shared info page from start(), and remove the pte = 0xffffffff hack
- vector.S: in hypervisor_callback() make sure %esi points to
HYPERVISOR_shared_info before accessing the info page. Remplace some
hand-written assembly with the equivalent macro defined in frameasm.h
- more debug code, dissabled by default.

while here added my copyright on some files I worked on in 2005.
 1.9 11-Dec-2005  christos branches: 1.9.2;
merge ktrace-lwp.
 1.8 28-Jun-2005  yamt branches: 1.8.2;
create opt_pcifixup.h to match with the recent i386 change.
 1.7 16-Jun-2005  bouyer Allow compiling a domain0 kernel with vga but without pckbc, and add
console support for USB keyboard. Problem pointed out by Karl Janmar on
port-xen.
 1.6 11-Mar-2005  bouyer branches: 1.6.2;
Properly define NISA and NPCI; cleanup use of NISA and NPCI.
 1.5 09-Mar-2005  bouyer Merge the bouyer-xen2 branch. This add supports for the Xen 2.0 virtual
machine kernel (both privileged and non-privileged domains), and remove support
for the old xen 1.2.
 1.4 04-Feb-2005  jmc Add opt_scsipi_debug.h to list since compat_linux pulls in scsipi now for sg
driver
 1.3 24-Apr-2004  cl branches: 1.3.2; 1.3.8; 1.3.10;
Add keyboard support and wscons config options.
 1.2 24-Apr-2004  cl Add vga display support.
 1.1 11-Mar-2004  cl branches: 1.1.2;
Add port to the Xen virtual machine monitor.
(see http://www.cl.cam.ac.uk/Research/SRG/netos/xen/)
 1.1.2.1 22-May-2004  he Pull up revisions 1.2-1.3 (requested by cl in ticket #337):
Upgrade xen support:
- add block device driver
- network device driver bug fixes
- support for vga/keyboard/mouse
- support for domain0 operations
- fix /dev/mem and i386_iopl, reboot, event dispatch
- fix clock support, cpu speed report, lazy fpu switching
- add xen12load loader
- sys/arch/xen parts of build.sh release support
[cl, ticket #337]
 1.3.10.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.10.1 12-Feb-2005  yamt sync with head.
 1.3.8.1 29-Apr-2005  kent sync with -current
 1.3.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.3.2.6 01-Apr-2005  skrll Sync with HEAD.
 1.3.2.5 04-Feb-2005  skrll Sync with HEAD.
 1.3.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.3.2.2 03-Aug-2004  skrll Sync with HEAD
 1.3.2.1 24-Apr-2004  skrll file files.compat was added on branch ktrace-lwp on 2004-08-03 10:43:10 +0000
 1.6.2.3 08-Jan-2007  ghen Pull up following revision(s) (requested by bouyer in ticket #1622):
sys/arch/xen/conf/files.xen: revision 1.49 via patch
sys/arch/xen/i386/autoconf.c: revision 1.19 via patch
sys/arch/xen/conf/files.compat: revision 1.13 via patch
sys/arch/xen/i386/mainbus.c: revision 1.10 via patch
sys/arch/xen/i386/bios32.c: revision 1.1 via patch
sys/arch/i386/conf/XEN2_DOM0: revision 1.9 via patch
sys/arch/xen/i386/locore.S: revision 1.19 via patch
Map the ISA hole on Xen, which allows us to access the SMBios, which allows
us to find the IPMI address. Add IPMI support on Xen (commented out for now)
 1.6.2.2 07-Apr-2006  tron Apply patch (requested by bouyer in ticket #1245):
Pull up Xen3 domU support. This adds support for the Xen-3 memory bootstrap,
xenstore, and block and network device frontend. Xen-3 support is turned
on by 'options XEN3', which disable Xen-2 support.
Changes affecting non-xen3 specific code:
- xbd and xennet at hypervisor now attaches with xbd_hypervisor and
xennet_hypervisor
- x86_atomic_* renamed to xen_atomic_*
- use genassim.cf to pull in more constant from include files for assembly
- Map the shared info page from locore.S instead of the 0xffffffff hack
in xen_machdep.c
- remove some unused code
- some __asm__ __volatile__ -> __asm volatile and __inline__ -> inline
- more debug code
 1.6.2.1 28-Jun-2005  tron Pull up revision 1.7 (requested by bouyer in ticket #482):
Allow compiling a domain0 kernel with vga but without pckbc, and add
console support for USB keyboard. Problem pointed out by Karl Janmar on
port-xen.
 1.8.2.6 04-Feb-2008  yamt sync with head.
 1.8.2.5 21-Jan-2008  yamt sync with head
 1.8.2.4 07-Dec-2007  yamt sync with head
 1.8.2.3 26-Feb-2007  yamt sync with head.
 1.8.2.2 30-Dec-2006  yamt sync with head.
 1.8.2.1 21-Jun-2006  yamt sync with head.
 1.9.2.1 01-Feb-2006  yamt sync with head.
 1.10.10.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.10.8.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.10.6.1 11-Apr-2006  yamt sync with head
 1.10.4.1 22-Apr-2006  simonb Sync with head.
 1.10.2.1 09-Sep-2006  rpaulo sync with head
 1.11.10.1 22-Oct-2006  yamt sync with head
 1.11.8.2 12-Jan-2007  ad Sync with head.
 1.11.8.1 18-Nov-2006  ad Sync with head.
 1.14.30.2 18-Feb-2008  mjf Sync with HEAD.
 1.14.30.1 08-Dec-2007  mjf Sync with HEAD.
 1.14.28.2 13-Nov-2007  bouyer catch up with changes in HEAD.
 1.14.28.1 17-Oct-2007  bouyer Prepare for xenamd64:
- kill xen/i386/identcpu.c, use i386/i386/identcpu.c instead (with a few
#ifndef XEN)
- move some files that can be shared between i386 and amd64 from
xen/i386 to xen/x86 (or to xen/xen for non-cpu-specific code)
- split assembly out of xen/include/hypervisor.h to xen/include/hypercalls.h
- use <xen/...> instead of <machine/...> for cpu-independant include files.

more work needed here, i386-specific files should got out of arch/xen to
arch/xeni386, and more code shared with arch/i386.
 1.14.24.2 23-Mar-2008  matt sync with HEAD
 1.14.24.1 09-Jan-2008  matt sync with HEAD
 1.14.22.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.14.6.1 03-Dec-2007  ad Sync with HEAD.
 1.15.6.3 19-Jan-2008  bouyer Sync with HEAD
 1.15.6.2 13-Jan-2008  bouyer Work in progress on xeni386 PAE support:
Make xeni386 build with a 64bit paddr_t. For this vaddr_t vs paddr_t vs
pointers usages had to be clarified.
If 'options PAE' is present in a Xen3 kernel, switch paddr_t, pd_entry_t
and pt_entry_t to 64bits, and add the PAE entry in the __xen_guest ELF section.
 1.15.6.1 07-Jan-2008  bouyer Move Xen support to i386/i386/machdep.c. two less files in xen/ :)
 1.18.28.1 21-Apr-2010  matt sync to netbsd-5
 1.18.24.2 01-Nov-2009  jym Sync with HEAD.
 1.18.24.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.18.20.1 05-Oct-2009  sborrill Pull up the following revisions(s) (requested by jmcneill in ticket #1061):
sys/arch/xen/conf/files.compat: revision 1.22
Extra file required in addition to original request.
 1.18.18.1 03-Mar-2009  skrll Sync with HEAD.
 1.18.10.3 11-Mar-2010  yamt sync with head
 1.18.10.2 19-Aug-2009  yamt sync with head.
 1.18.10.1 04-May-2009  yamt sync with head.
 1.22.12.2 30-Oct-2012  yamt sync with head
 1.22.12.1 17-Apr-2012  yamt sync with head
 1.23.10.2 03-Dec-2017  jdolecek update from HEAD
 1.23.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.24.18.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.24.14.2 28-Aug-2017  skrll Sync with HEAD
 1.24.14.1 05-Feb-2017  skrll Sync with HEAD
 1.25.8.2 22-Mar-2018  martin 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.
 1.25.8.1 01-Aug-2017  snj Pull up following revision(s) (requested by maxv in ticket #164):
distrib/sets/lists/base/md.amd64: revision 1.269
distrib/sets/lists/debug/md.amd64: revision 1.97
sys/arch/amd64/conf/GENERIC: revision 1.460
sys/arch/amd64/conf/files.amd64: revision 1.89
sys/arch/i386/conf/GENERIC: revision 1.1157
sys/arch/i386/conf/files.i386: revision 1.379
sys/arch/i386/i386/i386_trap.S: revision 1.7-1.8
sys/arch/i386/include/frameasm.h: revision 1.16
sys/arch/x86/include/sysarch.h: revision 1.12
sys/arch/x86/x86/pmc.c: revision 1.8-1.10
sys/arch/x86/x86/sys_machdep.c: revision 1.36
sys/arch/xen/conf/files.compat: revision 1.26
sys/secmodel/suser/secmodel_suser.c: revision 1.43
sys/sys/kauth.h: revision 1.74
usr.bin/pmc/Makefile: revision 1.5
usr.bin/pmc/pmc.1: revision 1.12-1.13
usr.bin/pmc/pmc.c: revision 1.24-1.25
style
--
style
--
Disable interrupts for T_NMI (inline calltrap). Note that there's still a
way to evade the NMI mode here, if a segment register faults in
INTRFASTEXIT; but we don't care. I didn't test this change, but it seems
fine enough.
--
Make the PMC syscalls privileged.
--
Check argc, and add a message.
--
include opt_pmc.h
--
Build the pmc tool on amd64.
--
Properly handle overflows, and take them into account in userland.
--
Update.
--
Enable PMCs by default.
--
Sort sections. Fix macro usage.
 1.30.4.1 10-Jun-2019  christos Sync with HEAD
 1.30.2.2 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.30.2.1 28-Jul-2018  pgoyette Sync with HEAD
 1.32.10.1 25-Apr-2020  bouyer Include again xen/conf/files.compat for PV kernels, and make it build.
My build.sh -u used stale opt_*.h files ...
 1.189 17-Oct-2023  bouyer XENPVH option is not used. Fix consinit.c to use XENPVHVM as intended
and XENPVH from defflag
 1.188 17-Oct-2023  bouyer Support non-VGA framebuffers for Xen dom0. This is mandatory for graphic
console on EFI-only hardware.
Add a xen_genfb_getbtinfo() function which will return a btinfo_framebuffer
structure, filled in with parameters provided by Xen
when runing as a Xen dom0, call xen_genfb_getbtinfo() instead of
lookup_bootinfo(BTINFO_FRAMEBUFFER) when adding properties to the
PCI graphic device (when genfb is attached) and in x86_genfb_init()
when genfb is used as console.
x86/x86/consinit.c: If running as a Xen dom0, use xen_genfb_getbtinfo()
to check if we have a genfb console
xen/x86/consinit.c: support genfb as possible console
xen/x86/consinit.c: use the hypervior IO as console until a better one
is found. If the hypervisor is using a serial port for boot messages,
we'll get NetBSD's boot message on the serial port too until
the real console takes over.
xen/x86/autoconf.c: rework device_register() to be closer to the x86 version.
Especially make sure that device_pci_register() is called.
 1.187 31-Aug-2022  bouyer branches: 1.187.4;
Work in progress on dom0 PVH support: ioctl support for tools.
Basically, in PVH mode (where XENFEAT_auto_translated_physmap is enabled),
the hypervisor will not map foreing ressources in our virtual address
space for us. Instead, we have to pass it an address in our physical
address space (but not mapped to some RAM) where the ressource will show up
and then enter this PA in pour page table.

For this, introduce xenmem_* which manage the PA space. In PVH mode this
is just allocated from the iomem_ex extent.

With this, I can start a PV domU, and the guest's kernel boots (and
the console works). It hangs because the backend driver can't map the
frontend ressources (yet).

Note that, per https://xenbits.xen.org/docs/unstable/support-matrix.html,
dom0 PVH support is still considered experimental by Xen.
 1.186 26-May-2020  bouyer Add need-flags for kernfs.
Compile Xen kernfs support only if kernfs is compiled in the kernel.
Should fix MODULAR build.
 1.185 05-May-2020  bouyer Make DOM0OPS build for PVH/PVHVM too
 1.184 02-May-2020  bouyer This is called pvh_consinit not hvm_consinit
 1.183 02-May-2020  bouyer 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().
 1.182 25-Apr-2020  bouyer 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
 1.181 21-Apr-2020  msaitoh 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.
 1.180 03-Apr-2020  ad branches: 1.180.2;
CPU topology makes almost no sense for Xen, and populates it with B/S values
 1.179 07-Sep-2019  maxv Merge amd64func.S into cpufunc.S, and clean up.
 1.178 14-Feb-2019  cherry branches: 1.178.4;
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.
 1.177 14-Feb-2019  cherry Snag the final bits of PV only code to conditionally compile under
-DXENPV

This completes the bifurcation.

The next step is to add -DXENPVHVM code.
 1.176 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.175 25-Dec-2018  mlelstv Make ipmi driver available to other platforms.
Add ACPI attachment.
 1.174 25-Dec-2018  cherry 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!
 1.173 24-Dec-2018  cherry Do not include files for MSI support on XEN dom0.

We do not support MSI as of now.
 1.172 22-Dec-2018  cherry This change modifies the mainbus(4) entry point for all x86 sub-archs
in the following way:

i) It provides a unified entry point in
x86/x86/mainbus.c:mainbus_attach()
ii) It carves out the preliminary bus attachment sequence that is
common to all sub-archs into
x86/x86/mainbus.c: x86_cpubus_attach()
iii) It consolidates the remaining pathways as internal callee
functions so that these may be called piecemeal if required. A
special usecase of this is XEN PVHVM which may need to call the
native configure path, the xen configure path, or both.
iv) It moves the driver private data structures from
i386/i386_mainbus.c to an x86/ level one. This allows for other
sub-arch's to do similar, if needed. (They do not at the moment).
v) For dom0 kernels, it enables 'acpi0 at mainbus?' and
'acpi0 at hypervisorbus'. This serves two purposes:
a) To demonstrate the possibility of dynamic configuration tree
traversal ordering changes.
b) To allow for the common acpi_check(self, "acpibus") call in
x86/mainbus.c to not barf when it is called from the dom0 attach
path. We allow for the acpi0 device to be a child of mainbus with
the changes to amd64/conf/XEN3_DOM0 and i386/conf/XEN3PAE_DOM0
without actually probing further in the code. This path will later
be pursued in a PVHVM boot codepath.

There should be no operative changes with this change. If there are,
please complain loudly.
 1.171 22-Dec-2018  cherry Move mainbus(4) driver files in various x86 sub-archs to name prefixed
versions. This allows us to further modularise them by unifying common
bus probe code in x86/x86/mainbus.c to be introduced next.

This commit has no functional changes. It is done for ease of
visibility of newer diffs in the queue.
 1.170 26-Jul-2018  maxv Merge the content of xen_debug.c into xen_machdep.c, there is only one
function.
 1.169 23-May-2018  maxv branches: 1.169.2;
Merge convert_xmm_s87.c into fpu.c. It contains only two functions, that
are used only in fpu.c.
 1.168 18-Mar-2018  christos Separate the compat code in its own file to facilitate module building.
 1.167 17-Mar-2018  christos dedup microcode handling.
 1.166 16-Mar-2018  maxv Remove ipkdb from i386. Also remove unused references in amd64.

I already talked about doing that six months ago on port-i386@. Back then
it was as general cleanup, but now, with SVS etc, we do actually have
good reasons for simplifying the entry points.

Ok kamil@. (christos@ was in the conversation too)
 1.165 22-Jan-2018  jdolecek branches: 1.165.2;
xen has separate list, update here also for x86/pmap_tlb.c -> x86/x86_tlb.c
 1.164 02-Dec-2017  maxv Drop COMPAT_13 on amd64, already not enabled. Reduces the number of
critical places.
 1.163 06-Nov-2017  cherry Summary: xen/x86/intr.c has been retired. Don't try to build it.
 1.162 04-Nov-2017  cherry Remove bitrotted xen specific versions of pci, pciide machdep related code.

Use the common x86/ code instead.
 1.161 04-Nov-2017  cherry Retire xen/x86/intr.c and use the new xen specific glue in x86/x86/intr.c

The purpose of this change is to expose the x86/include/intr.h API
to drivers. Specifically the following functions:

void *intr_establish_xname(...);
void *intr_establish(...);
void intr_disestablish(...);

while maintaining the old API from xen/include/evtchn.h, specifically
the following functions:

int event_set_handler(...);
int event_remove_handler(...);

This is so that if things break, we can keep using the old API until
everything stabilises. This is a stepping stone towards getting the
actual XEN event callback path rework code in place - which can be
done opaquely behind the intr.h API - NetBSD/XEN specific drivers that
have been ported to the intr.h API should then work without
significant further modifications.
 1.160 04-Nov-2017  cherry On XEN dom0, the function xen/x86/intr.c:xen_intr_map() is used to map
hardware interrupts to XEN callbacks called 'events'. This function
combines both the allocation and the binding.

This change is the first part of breaking up that combination into
xen_pirq_alloc() and the binding will happen as part of the
pic_addroute() callback of a new pseudo PIC_XEN

This code will be added later on.
 1.159 04-Nov-2017  cherry On XEN PV, the ISA 8259A PIC is only used on dom0
 1.158 04-Nov-2017  cherry In XEN PV, the idt vector table is not required to be altered at
runtime, since only entries for exceptions/traps are registered with
the hypervisor and interrupts are managed via a completely different
mechanism.

This change uses the idt_vec_reserve() mechanism nevertheless,
modifying it slightly to only do namespace management in XEN, while on
native it will continue to do idt entry init as before.

Rationale: Consistent API usage and potential future merging of
XEN/non-XEN code.

There are no functional changes in this commit.
 1.157 04-Nov-2017  cherry opt_intrdebug.h - this unbreaks the i386 DOMU build under some conditions
 1.156 15-Aug-2017  maxv Merge into x86/.
 1.155 15-Aug-2017  maxv Merge into x86/.
 1.154 12-Aug-2017  maxv Remove vm86.

Pass 3.
 1.153 09-Aug-2017  maxv Remove references to compat_ibcs2.
 1.152 01-Aug-2017  maxv Move arch/i386/i386/freebsd_* into compat/freebsd/. COMPAT_FREEBSD is
i386-specific.
 1.151 01-Aug-2017  maxv Don't include files.svr4 and files.svr4_32.
 1.150 29-Jul-2017  maxv Drop support for svr4 on i386. This feature is not maintained, not
reliable, and of a limited use case. Most svr4 applications got time to be
ported to linux, and we do have a functional, maintained linux emulation.

Reduces the number of entry points into the kernel, the number of
places that need special care (cpu context).

Note that compat_svr4 is still available on sparc.
 1.149 16-Jul-2017  cherry branches: 1.149.2;
Unify the xen and native x86/ interrupt setup functions and
spl traversal data structures.

This is towards PVHVM.
 1.148 22-Jun-2017  khorben Register support for SD card readers with Xen DOM0 kernels

Tested on a Lenovo ThinkPad T440s (amd64)
 1.147 23-May-2017  nonaka branches: 1.147.2;
x86: hypervisor detection from FreeBSD for x2APIC support.
 1.146 24-Mar-2017  maxv Don't compile PMCs on Xen.
 1.145 10-Mar-2017  maxv Move pmc.c into x86/, it can be shared with amd64.
 1.144 17-Feb-2017  kre Copy maxv's files.i386 change to files.xen ... this might fix the i386
xen kernel builds (I am doing a test build in parallel with this commit,
this shouldn't make things worse ... I will make further changes if
needed after my build finishes.)

Note: I am not currently in a position to test a Xen3 DomU kernel
(let alone Dom0) so I have no way of knowing whether a Xen kernel
with PMC included will actually work correctly or not.

If this results in a system that builds, I'd appreciate it if someone
who can test the Xen3_DOMU kernel could do so.
 1.143 15-Dec-2016  kamil branches: 1.143.2;
Add support for hardware assisted watchpoints/breakpoints API in ptrace(2)

Add new ptrace(2) calls:
- PT_COUNT_WATCHPOINTS - count the number of available hardware watchpoints
- PT_READ_WATCHPOINT - read struct ptrace_watchpoint from the kernel state
- PT_WRITE_WATCHPOINT - write new struct ptrace_watchpoint state, this
includes enabling and disabling watchpoints

The ptrace_watchpoint structure contains MI and MD parts:

typedef struct ptrace_watchpoint {
int pw_index; /* HW Watchpoint ID (count from 0) */
lwpid_t pw_lwpid; /* LWP described */
struct mdpw pw_md; /* MD fields */
} ptrace_watchpoint_t;

For example amd64 defines MD as follows:
struct mdpw {
void *md_address;
int md_condition;
int md_length;
};

These calls are protected with the __HAVE_PTRACE_WATCHPOINTS guard.

Tested on amd64, initial support added for i386 and XEN.

Sponsored by <The NetBSD Foundation>
 1.142 13-Dec-2016  kamil Torn down KSTACK_CHECK_DR0, i386-only feature to detect stack overflow

This feature was intended to detect stack overflow with CPU Debug Registers
(x86). It was never ported to other ports, neither amd64 and should be
adapted for SMP...

Currently there might be better ways to detect stack overflows like page
mapping protection. Since the number of Debug Registers is restricted
(4 on x86), torn it down completely.

This interface introduced helper functions for Debug Registers, they will
be replaced with the new <x86/dbregs.h> interface.

KSTACK_CHECK_DR0 was disabled by default and won't affect ordinary users.

Sponsored by <The NetBSD Foundation>
 1.141 20-May-2016  jnemeth branches: 1.141.2;
make CPU microcode loading dependent on both DOM0OPS AND CPU_UCODE
 1.140 27-Feb-2016  mlelstv no condition for cpu_rng here
 1.139 27-Feb-2016  mlelstv add missing cpu_rng.c to kernel
 1.138 11-Nov-2015  skrll Fix XEN build - does XEN really want/need pmap_pv_track?
 1.137 04-Jan-2015  uebayasi Include files.sljit as i386/amd64 do.
 1.136 15-Dec-2014  christos there is no ibcs2 in amd64 [yet?]
 1.135 15-Dec-2014  ozaki-r Add two new compat files for Xen on amd64
 1.134 11-Oct-2014  uebayasi branches: 1.134.2;
Mark machdep files.
 1.133 12-Feb-2014  dsl branches: 1.133.4; 1.133.8;
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).
 1.132 11-Feb-2014  dsl Move sys/arch/amd64/amd64/fpu.c and sys/arch/amd64/include/fpu.h
into sys/arch/x86 in preparation for using the same code for i386.
 1.131 07-Feb-2014  dsl Convert the amd64 build to use x86/cpu_extended_state.h so that the fpu
definitions match those of i386.
Mostly just structure and field renames, in addition:
1) process_xmm_to_s87() and process_s87_to_xmm() moved into
x86/convert_xmm_s87.c so they can be used by amd64's netbsd32 code.
2) The linux signal code simplified to use a structure copy for ths fxsave
data - it matches the hardware definition and won't change.
 1.130 26-Jan-2014  dsl 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!
 1.129 03-Oct-2012  dsl branches: 1.129.2;
Remove all references to KVM86.
It was only ever used by APMBIOS - and then only if an option was selected.
Probably didn't work well at all!
 1.128 29-Aug-2012  drochner branches: 1.128.2;
Extend the CPU microcode update framework to support Intel x86 CPUs.
Contrary to the AMD implementation, it doesn't use xcalls to distribute
the update to all CPUs but relies on cpuctl(8) to bind itself to the
right CPU -- to keep it simple and avoid possible problems with
hyperthreading.
Also, it doesn't parse the vendor supplied file to pick the right
part for the present CPU model but relies on userland to prepare
files with specific filenames. I'll commit a pkg for this in a minute
(pkgsrc/sysutils/intel-microcode).
The ioctl interface changed; compatibility is provided (should be
limited to COMPAT_NETBSD6 as soon as this is available).
 1.127 27-Jun-2012  jym Retire XEN_COMPAT_030001 as detailed on port-xen@:

http://mail-index.netbsd.org/port-xen/2012/06/25/msg007431.html

The xen_p2m API comes next.

ok bouyer@.
Tested on i386 PAE and amd64 (Xen 3.3 on private test bed, and
Xen 3.4 for Amazon EC2).

FWIW, Amazon always reported:

hypervisor0 at mainbus0: Xen version 3.4.3-kaos_t1micro

multiple times for Europe and US West-1, so I guess they are now at
3.4 (32 and 64 bits).
 1.126 07-May-2012  jym Merge i386 and amd64 version of db_memrw.c.

Use this opportunity to skip calculating the VA of the page. Let the CPU
deal with the invalidation itself through invlpg + destination address to
avoid converting between canonical/non canonical forms.
 1.125 14-Jan-2012  pgoyette No need for CPU_UCODE here now that it is global
 1.124 13-Jan-2012  cegger Support CPU microcode loading via cpuctl(8).
Implemented and enabled via CPU_UCODE kernel config option
for x86 and Xen Dom0.
Tested on different AMD machines with different
CPU families.

ok wiz@ for the manpages
ok releng@
ok core@ via releng@
 1.123 22-Sep-2011  jym branches: 1.123.2; 1.123.6;
Expose Xen kernfs entries inside a domU. Patch originally from sborrill@,
slightly modified by me to profit from runtime checks for dom0 privileges
instead of using compile time macros (DOM0OPS).

It should now be possible to use pkgsrc's sysutils/xentools inside
a domU to query XenStore entries (or even modify part of it if the domain
has enough rights).
 1.122 10-Aug-2011  cherry xen ipi infrastructure
 1.121 13-Jun-2011  pgoyette Include required file for xen acpi
 1.120 12-Jun-2011  jruoho Fix build failure for the odd child, as pointed out by pgoyette@.
 1.119 12-Jun-2011  rmind 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.
 1.118 26-Apr-2011  joerg branches: 1.118.2;
Remove PECOFF/Win32 emulation.
 1.117 26-Apr-2011  joerg Remove Darwin, MACH and Mach-O support.
 1.116 18-Apr-2011  jym Large rewrite of the balloon driver. This one:

- turns balloon into a driver that attaches to xenbus(4). This allows to
disable the functionality either at compile time or boot time via
userconf(4). Driver can implement detach or pmf(9) hooks if deemed
necessary.

- keeps Cherry's locking model, but simplify it a bit. There is now
only one target value serialized inside balloon, we do not feedback
alternative value to Xenstore (clients are not expected to see its value
evolve behind their back, and can't do much about that either)

- implements min threshold; this is an admin-settable value that tells
driver to "not balloon below this threshold." This can be used by domain
to keep memory reservations, useful if activity is expected in the near
future.

- in addition to min threshold, the driver implements internally a
safeguard value (uvmexp.freemin + 1MiB), so that admin cannot
inadvertently set min to a very low value forcing domain into heavy
memory pressure and swapping.

- create the sysctl(8) kern.xen.balloon tree. 4 nodes are actually present
(values are in KiB):
- min: (rw) an admin-settable value that prevents ballooning below this
mark
- max: (ro) the maximum size for reservation, as set by xm(1) mem-max.
- current: (ro) the current reservation for domain.
- target: (rw) the targetted reservation for domain.

- fix a few limitations here and there, most notably the max_reservation
hypercall, and KiB vs pages representations at interfaces.

The driver is still turned off by default. Enabling it would need more
approval, especially from bouyer@, cherry@ and cegger@.

FWIW: tested it two days long, from amd64 dom0 (with dom0 ballooning
enabled for xend), and bunch of domUs. Did not notice anything suspicious.

XXX it still has one big limitation: it cannot hotplug memory pages in
uvm(9) if they were not present beforehand. Example: ballooning above
physmem will give more pages to domain but it won't use it to serve
allocations, unless we teach uvm(9) how to handle the extra pages.
 1.115 11-Apr-2011  cegger build xen kernels again after db_trace merge
 1.114 03-Apr-2011  dyoung Clean up excessive #ifdef'age of NMI trap handling for amd64/i386/xen.
Handle NMI in all Xen kernels.
 1.113 24-Feb-2011  jruoho Move PowerNow! to the cpufeaturebus.
 1.112 24-Feb-2011  jruoho Add cpufeaturebus and est(4) for Xen.
 1.111 23-Feb-2011  jruoho Move ENHANCED_SPEEDSTEP, or henceforth est(4), to the cpufeaturebus.
 1.110 02-Dec-2010  bouyer branches: 1.110.2; 1.110.4;
Make maxpartitions 16 on !i386. Fixes hardwiring root on device autoconf
index > 0 on amd64. Problem reported and patch tested by Tobias Nygren.
 1.109 08-Jul-2010  rmind Unify i386 and amd64 procfs MD code into x86.
 1.108 06-Jul-2010  cherry The Xen balloon driver enables growing and shrinking
PV domains on the fly, by collaborating with UVM and the hypervisor
 1.107 10-May-2010  dyoung Provide pmap_enter_ma(), pmap_extract_ma(), pmap_kenter_ma() in all x86
kernels, and use them in the bus_space(9) implementation instead of ugly
Xen #ifdef-age. In a non-Xen kernel, the _ma() functions either call or
alias the equivalent _pa() functions.

Reviewed on port-xen@netbsd.org and port-i386@netbsd.org. Passes
rmind@'s and bouyer@'s inspection. Tested on i386 and on Xen DOMU /
DOM0.
 1.106 03-Nov-2009  dyoung branches: 1.106.2; 1.106.4;
Add a kernel configuration flag, SPLDEBUG, that activates a per-CPU log
of transitions to IPL_HIGH from lower IPLs. SPLDEBUG is only available
on i386 and Xen kernels, today.

'options SPLDEBUG' adds instrumentation to spllower() and splraise() as
well as routines to start/stop debugging and to record IPL transitions:
spldebug_start(), spldebug_stop(), spldebug_raise(), spldebug_lower().
 1.105 05-Oct-2009  rmind Remove X86_IPI_WRITE_MSR (and msr_ipifuncs.c), replace all uses in drivers
with xc_broadcast(). AMD K8 PowerNow driver tested by <jakllsch>, thanks!

Closes PR/37665.
 1.104 16-Aug-2009  manu Build COMPAT_DARWIN and COMPAT_MACH as a Xen domU too
 1.103 05-Aug-2009  jym Add Intel SpeedStep and AMD PowerNow! support in Xen dom0. MSR operations
are now compiled in by default.

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

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

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

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

Commit requested by bouyer@.
 1.102 29-Jul-2009  cegger remove Xen2 support.
ok bouyer@
 1.101 24-Jul-2009  dyoung There's no such file as arch/i386/i386/core_machdep.c, so don't
list it here.
 1.100 16-Jun-2009  bouyer Split mc146818-related functions from clock.c into rtc.c.
Call rtc_set_ymdhms() from xen/xen/clock.c:xen_rtc_set() for xen3 dom0
kernels as the Xen3 hypervisor doesn't write the new date/time to the CMOS
by itself.
Now a XEN3_DOM0 kernel properly updates the CMOS time.
 1.99 30-Apr-2009  pgoyette Include cpu_topology.c for xen kernels, too.
 1.98 18-Apr-2009  cegger build mp.c for xen, too.
Fixes linking failures of Dom0 kernels. (Hi dyoung)
 1.97 16-Apr-2009  cegger make xen kernels build again after the merge of syscall.c
 1.96 31-Mar-2009  rmind Sync with recent i386/amd64 source merges - fix Xen builds.
 1.95 19-Feb-2009  jmcneill vesabios is no more
 1.94 14-Feb-2009  cube Don't set version deep in the source tree if it's older than the one in
conf/files.
 1.93 13-Feb-2009  bouyer Work in progress on PCI front-end/back-end support
front-end:
- add a xpci* at xenbus? which provides pci busses from the dom0
xpci provides support routines for PCI config space operations and
enumeration in xpci_xenbus.c
- hypervisor.c: do dom0-style PCI attach only ifdef DOM0OPS
- pci_intr_machdep.c: check line value only if DOM0OPS

back-end:
- add a pciback* at pci? device which takes precedences over all
other PCI devices (match return 500) and matches all devices passed
to pciback.hide option on boot command line.
It exports the PCI device informations to files in /kern/xen/pci/
- hypervisor.c: create /kern/xen earlier so pciback can create its
entries while PCI devices are probed
- xen_machdep.c: add handling for pciback.hide=

frontend is know working on Xen 3.1.x dom0 with ahc(4) and pciide(4)
devices. uhci(4) fail when trying to allocate a large contigous DMA
buffer.

backend is work in progress; support in xentools is not there yet.
 1.92 18-Jan-2009  bouyer branches: 1.92.2;
The Xen PCI_BUS_FIXUP/PCI_ADDR_FIXUP has rotted, catch up with x86 changes
in this area. Patch provided by FUKAUMI Naoki in PR#40356.
 1.91 20-Dec-2008  ad - Kill NOREDZONE.
- Make the redzone conditional on DIAGNOSTIC.
- Give amd64 an additional page for the uarea. 2 is not enough.
 1.90 20-Nov-2008  ad Put the COMPAT_NOMID stuff into its own file.
 1.89 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.88 03-Aug-2008  joerg branches: 1.88.2; 1.88.4;
Move some MD declarations from x86/pci/files.pci to x86/conf/files.x86,
so that Xen can use the former.

Drop Xen's pcib.c in favor of the x86 code and thereby unbreak ichlpcib.
 1.87 11-May-2008  ad branches: 1.87.4;
Update xen for identcpu changes.
 1.86 10-May-2008  ad Make xen build after tsc changes.
 1.85 09-May-2008  joerg Make cpu_idle a macro calling a function pointer on x86.
Select the Xen idle routine for Xen, mwait if supported by the CPU and
it is not AMD and halt otherwise. As reported by Christoph Egger,
AMD Barcelona keeps the CPU in C0 state with MWAIT, contrary to HLT,
which uses C1 and therefore much less power.
 1.84 25-Apr-2008  ad branches: 1.84.2; 1.84.4;
Include null IPI functions if !MULTIPROCESSOR.
 1.83 27-Feb-2008  dogcow branches: 1.83.2;
fix longrun build borkage on i386
 1.82 20-Feb-2008  drochner branches: 1.82.2; 1.82.6;
Since files.wscons et al. are included by ~all ports anyway, include
them in the mi "files" file, and remove include statements from md files.
These shouldn't pull in additional kernel code when not in use, so it
shouldn't do any harm except a risk of namespace collisions which
should be easy to fix.
 1.81 31-Jan-2008  jmmv Let Xen kernels build with "options MODULAR" enabled by pulling in the
appropriate kobj_machdep.c file.
 1.80 25-Jan-2008  joerg Refactor in_cksum/in4_cksum/in6_cksum implementations:
- All three functions are included in the kernel by default.
They call a backend function cpu_in_cksum after possibly
computing the checksum of the pseudo header.
- cpu_in_cksum is the core to implement the one-complement sum.
The default implementation is moderate fast on most platforms
and provides a 32bit accumulator with 16bit addends for L32 platforms
and a 64bit accumulator with 32bit addends for L64 platforms.
It handles edge cases like very large mbuf chains (could happen with
native IPv6 in the future) and provides a good base for new native
implementations.
- Modify i386 and amd64 assembly to use the new interface.

This disables the MD implementations on !x86 until the conversion is
done. For Alpha, the portable version is faster.
 1.79 16-Jan-2008  ad Remove options MATH_EMULATE.
 1.78 12-Jan-2008  ad - Split crashdump code out into its own file.
- Remove NO_SPARSE_DUMP.
- Minor KNF, sprinkle static.
 1.77 11-Jan-2008  bouyer Merge the bouyer-xeni386 branch to head, at tag bouyer-xeni386-merge1 (the
branch is still active and will see i386PAE support developement).
Sumary of changes:
- switch xeni386 to the x86/x86/pmap.c, and the xen/x86/x86_xpmap.c
pmap bootstrap.
- merge back most of xen/i386/ to i386/i386
- change the build to reduce diffs between i386 and amd64 in file locations
- remove include files that were identical to the i386/amd64 counterparts,
the build will find them via the xen-ma/machine link.
 1.76 01-Jan-2008  yamt try to detect processor resource sharing topologies. ie. package/core/smt IDs.
 1.75 03-Dec-2007  ad branches: 1.75.6;
Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.
 1.74 01-Dec-2007  bouyer Back out previous, majors.amd64 in files.amd64 is inside ifndef xen/endif
 1.73 30-Nov-2007  dsl Don't pull in majors.amd64 here, we get another copy from files.amd64
and config bleats like mad.
 1.72 28-Nov-2007  yamt - merge {i386,xen}/i386/trap.c.
- add a comment about a hack for xen2.
 1.71 22-Nov-2007  bouyer Pull up the bouyer-xenamd64 branch to HEAD. This brings in amd64 support
to NetBSD/Xen, both Dom0 and DomU.
 1.70 22-Nov-2007  yamt remove lock_machdep.c
 1.69 15-Nov-2007  ad Remove support for 80386 level CPUs. PR port-i386/36163.
 1.68 26-Oct-2007  xtraeme branches: 1.68.2;
xen/i386/cpu.c uses i686_mtrr_init_first if MTRR is defined, but
mtrr_i686.c wasn't built...
 1.67 26-Oct-2007  xtraeme ichlpcib(4) lives in x86/pci these days...
 1.66 26-Oct-2007  xtraeme - Share pchb(4) between i386 and amd64; one copy is enough for both.
- Move some of the x86 PCI devices into x86/pci/files.pci.
- Add more x86 stuff into x86/conf/files.x86.

ok joerg.
 1.65 17-Oct-2007  garbled Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.64 26-Sep-2007  ad branches: 1.64.2;
x86 changes for pcc and LKMs.

- Replace most inline assembly with proper functions. As a side effect
this reduces the size of amd64 GENERIC by about 120kB, and i386 by a
smaller amount. Nearly all of the inlines did something slow, or something
that does not need to be fast.
- Make curcpu() and curlwp functions proper, unless __GNUC__ && _KERNEL.
In that case make them inlines. Makes curlwp LKM and preemption safe.
- Make bus_space and bus_dma more LKM friendly.
- Share a few more files between the ports.
- Other minor changes.
 1.63 07-Jul-2007  tsutsui branches: 1.63.8; 1.63.10; 1.63.12;
Remove leftover netns stuff.
 1.62 28-Jun-2007  alc - add ichlpcib to XEN2 config file
- few cosmetics

tested with XEN2 and XEN3 kernel
ok bouyer@
 1.61 17-May-2007  yamt merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.60 12-May-2007  jld Convert the xen port to use timecounters; ok'ed by bouyer@.
 1.59 16-Apr-2007  ad branches: 1.59.2;
Share the sysarch stuff between the x86 ports. PR kern/36046.
 1.58 10-Apr-2007  macallan include files.wsfb
 1.57 05-Mar-2007  drochner branches: 1.57.2; 1.57.4;
clean up how cpus and ioapics are attached at the mainbus:
Seperate "cpubus" and "ioapicbus" -- while they share a common "address
space" (the apic id), the kernel doesn't use this fact. There are different
data passed to cpus and apics, which caused some ugly polymorphism. This
also saves the special "submatch" functions needed to distingush cpus
and ioapics for autoconf. (And it makes that "apid" locators wired
in the kernel configuration are honored now; this allows one to dumb down
an mp box to singleprocessor by userconfig.)
Print "apid" locators in the buses "print" function "as everyone does",
so the per-port cpu drivers don't need to do it.
Being here, constify "struct cpu_functions" and g/c the unused MP_PICMODE
flag.
 1.56 18-Feb-2007  dsl Get config(1) to supply the default values for BEEP_ONHALT.
 1.55 09-Feb-2007  ad branches: 1.55.2;
Merge newlock2 to head.
 1.54 18-Dec-2006  gdt Use agp_machdep.c from the new location (x86, not i386).
 1.53 19-Oct-2006  drochner branches: 1.53.2; 1.53.4;
remove relicts of COMPAT_AOUT, fixes compilation problems with old
kernel config files reported by Patrick Welche on current-users
 1.52 17-Oct-2006  bouyer XEN_NO_HYPERCALLPAGE is redundant with XEN_COMPAT_030001; make
XEN_COMPAT_030001 disable the hypercall page too and remove
XEN_NO_HYPERCALLPAGE
 1.51 17-Oct-2006  bouyer Add ELF_PADDR_OFFSET and VIRT_ENTRY strings to __xen_guest ELF section,
so that our kernels works with newer xen-3 hypervisors; and correct the value
of VIRT_BASE for dom0.
Now that we can embed the values of KERNBASE and KERNTEXTOFF in the binary
for Xen, make the domU memory layout the same as dom0 for Xen3 (making
it the other way round doens't work; probably because of alignement
constraints in the hypervisor). The old domU layout is used if options
XEN_COMPAT_030001 is present in the kernel config file. Enable this the
domU kernel config files for now, in case someone wants to run a NetBSD
domU on an older Xen3 installation.
 1.50 15-Oct-2006  xtraeme Enable Bluetooth support and devices (except bt3c that requires pcmcia)
for Xen.
 1.49 01-Oct-2006  bouyer Map the ISA hole on Xen, which allows us to access the SMBios, which allows
us to find the IPMI address. Add IPMI support on Xen (commented out for now)
 1.48 28-Sep-2006  bouyer Add Xen3 support for ACPI and/or MPBIOS + IOAPIC. To help with this, physical
CPUs are now configured on mainbus only in dom0, and only to know about
their APIC id. virtual CPUs are attached to hypervisor as:
vcpu* at hypervisor?
and this is what's used as curcpu(). The kernel config files needs to be
updated for this, see XEN3_DOM0 or XEN3_DOMU for examples.
XEN3_DOM0 now has acpi, MPBIOS and ioapic by default.
Note that a Xen dom0 kernel doens't have access to the lapic.
 1.47 24-Sep-2006  bouyer The Xen folks says everyone should use hypercall call page now, make it so.
Old hypercall call method still still available with
options XEN_NO_HYPERCALLPAGE
but this is disabled by default (xen-3.0.2-2 supports hypercall call page
just fine).
While there add a VIRT_BASE= string in __xen_guest section; from
Bastian Blank on port-xen@.
 1.46 11-Aug-2006  yamt branches: 1.46.2; 1.46.4;
"xm shutdown" support for xen3. ok'ed by Manuel Bouyer.
 1.45 12-Jul-2006  yamt branches: 1.45.2;
implement a simple NETTXF_csum_blank/NETRXF_csum_blank workaround
so that we can talk with linux guests at least.
just fill checksum field of received packets if the flag is set.
maybe should be revisited later.
 1.44 09-Jul-2006  christos include files.apm
 1.43 02-Jul-2006  bouyer block device backend driver for Xen3. Add
pseudo-device xbdback
in your config file to use.
 1.42 25-May-2006  bouyer branches: 1.42.2;
Always include xen_shm_machdep.c for Xen3, theorically a domU could also
provide backend services to other domains.
 1.41 23-May-2006  bouyer Add a network backend driver for Xen3. This will appear as a xvif pseudo
device in kernel config files.
 1.40 09-Apr-2006  bouyer branches: 1.40.2;
Add support for ACPI in xen-3 dom0 support. We can now boot a xen-3 dom0
kernel with a default xen comamnd line.
 1.39 04-Apr-2006  gdamore Convert existing ath users to new Makefile, except for amd64, which needs
the rules due to needing to conditionally postprocess the HAL object file.

Macppc needs a a non-ELF HAL (EABI) object, so take care of that by default
in the atheros include file.
 1.38 19-Mar-2006  bouyer Add a block device frontend driver for Xen-3. xbd at hypervisor now
attaches with xbd_hypervisor, adjust CFATTACH_DECL().
 1.37 06-Mar-2006  bouyer branches: 1.37.2; 1.37.4;
Fix build issues that didn't show up in my private tree.
 1.36 06-Mar-2006  bouyer Add a Xen Virtual Network device driver for Xenbus.
 1.35 06-Mar-2006  bouyer pull in the grant table and Xenbus interfaces, and attach xenbus at hypervisor.
 1.34 12-Feb-2006  tron branches: 1.34.2;
Share Intel hardware random number generator support between amd64 and
i386 port. This will benefit EM64T systems using Intel i9xx chipsets.
 1.33 15-Jan-2006  bouyer branches: 1.33.2; 1.33.4;
Snapshot of work in progress on NetBSD port to Xen3:
- kernel (both dom0 and domU) boot, console is functionnal and it can starts
software from a ramdisk
- there is no driver front-end expect console for domU yet.
- dom0 can probe devices and ex(4) work when Xen3 is booted without acpi
and apic support. But the on-board IDE doens't get interrupts.
The PCI code still needs work (it's hardcoded to mode 1). Some of this
code should be shared with ../x86
The physical insterrupt code needs to get MPBIOS and ACPI support, and
do interrupt routing to properly interract with Xen.
To enable Xen-3.0 support, add
options XEN3
to your kernel config file (this will disable Xen2 support)
Changes affecting Xen-2.0 support (no functionnal changes intended):
- get more constants from genassym for assembly code
- remove some unneeded registers move from start()
- map the shared info page from start(), and remove the pte = 0xffffffff hack
- vector.S: in hypervisor_callback() make sure %esi points to
HYPERVISOR_shared_info before accessing the info page. Remplace some
hand-written assembly with the equivalent macro defined in frameasm.h
- more debug code, dissabled by default.

while here added my copyright on some files I worked on in 2005.
 1.32 30-Dec-2005  jmmv branches: 1.32.2;
Add a 'struct bootinfo' to represent the bootinfo structure used in the
kernel by x86 platforms (instead of a simple char *). This way, the code
in, e.g., lookup_bootinfo, is a bit easier to understand.

While here, move the lookup_bootinfo function used in x86 platforms (amd64,
i386 and xen) to a common file (x86/x86_machdep.c), as it was exactly the
same in all of them.
 1.31 21-Nov-2005  bouyer Sync with i386/conf/GENERIC:
- add a buch of PCI storage devices
- add firewire devices
- add some missing PCI network devices
- add serial and parallel PCI adapters
- add lpt0 at isa
- add com1 at isa
com0 not added for the benefit of serial console users (it will conflicts
with the Xen kernel).
XXX this means that setups with serial console on com1 will now break with the
default kernel.
Use userconf(4) (add -c to kernel command line) or change your setup to
com0 instead (most bios allows arbitrary mappings of com ports)
 1.30 07-Nov-2005  yamt branches: 1.30.2;
some assym cleanup.
- move copyin and friends from locore.S to their own file, copy.S.
share it between i386 and xen.
- defparam KERNBASE and kill KERNBASE_LOCORE hack.
- add more symbols to assym.h and use it where appropriate.
 1.29 21-Aug-2005  bouyer Define a xendevbus atttibute and add it to hypervisor. Use it for xen devices
which attach to hypervisor. This allows to use config_found_ia() instead of
config_found(), instead of relying on the order of which device are
written in ioconf.c.
From Quentin Garnier.
 1.28 20-Aug-2005  bouyer Deal with the machine address space being non-contigous in bus_dmamem_alloc():
- Define _BUS_AVAIL_END to 0xffffffff, as we don't have an easy way to
find the upper bound for our machine address space (and this can change
when we swap pages with the hypervisor).
- implement _xen_bus_dmamem_alloc_range(), which will request a contigous
set of pages to the hypervisor if the pages returned by uvm_pglistalloc()
don't fit the constraints.
We can't deal with the low/high constraints yet, because Xen doesn't offer a
way to get pages in a specific ranges of addresses.

Based on patches from Dave Thompson (in private mail), with heavy hacking
by me.
 1.27 19-Aug-2005  bouyer Make PCI devices usable for non-domain0 kernels. Based on patches sent by
Ceri Storey to port-xen, with some additionnal changes by me:
- include bus_dma.c, bus_space.c and pci_machdep.c if pci is defined
instead of dom0ops
- Make various initialisations, and probe/attach pci busses based on NPCI
instead of DOM0OPS
- in conf/files.xen, move xen-specific devices before non-xen specific devices
so that the xen-specific match function is called first, to avoid false
attachement from too liberal match function in non-xen code.
 1.26 15-Jul-2005  yamt include cardbus/pcmcia.

XXX 32bit cards don't work due to the way how xen handles
pci configuration space.
 1.25 25-Jun-2005  dyoung branches: 1.25.2;
Don't include files.ath any more, it's disappeared.
 1.24 22-Jun-2005  dyoung Resolve conflicts in importation of 18-May-2005 ath(4) / net80211(9)
from FreeBSD. Introduce compatibility shims (sys/dev/ic/ath_netbsd.[ch],
sys/net80211/ieee80211_netbsd.[ch]). Update drivers (an, atu, atw,
awi, ipw, iwi, rtw, wi) for the new net80211(9) API.
 1.23 19-Jun-2005  chs add ath stuff.
 1.22 16-May-2005  yamt arch/i386/i386/linux_trap.c -> arch/x86/x86/linux_trap.c
 1.21 18-Apr-2005  bouyer Add sysmon_power attribute to hypervisor, and an handler for CMSG_SHUTDOWN
messages.
Now a NetBSD guest will reboot or shutdown on 'xm shutdown' commands in
domain0.
 1.20 17-Apr-2005  bouyer Remove
xenkbc at hypervisor
vga at hypervisor
they have been obsoleted by PCI and ISA support, and don't compile any more.
 1.19 16-Apr-2005  yamt tweak x86 bus_dma code so that it can be used by xen port.

- distinguish paddr_t and bus_addr_t.
for xen, use bus_addr_t in the sense of machine address.
- move _X86_BUS_DMA_PRIVATE part of bus.h into bus_private.h.
- remove special handling of xen_shm. we can always grab
machine address from pte.
 1.18 11-Mar-2005  bouyer branches: 1.18.2;
Define xen devices in i386/conf/majors.i386. This makes sure there won't
be conflics with regular i386 kernels.
 1.17 09-Mar-2005  bouyer Merge the bouyer-xen2 branch. This add supports for the Xen 2.0 virtual
machine kernel (both privileged and non-privileged domains), and remove support
for the old xen 1.2.
 1.16 04-Feb-2005  jmc vfr.c is still needed on the trunk or GENERIC doesn't compile...
 1.15 03-Feb-2005  bouyer vfr.c doesn't exists any more.
 1.14 14-Sep-2004  jdolecek branches: 1.14.4; 1.14.6; 1.14.8;
do not include "compat/aout/files.aout", COMPAT_AOUT is soon to be removed
 1.13 30-Aug-2004  drochner Phase out the use of a string as first "attach args" member to control
which bustype should be attached with a specific call to config_found()
(from a "mainbus" or a bus bridge).
Do it for isa/eisa/mca and pci/agp for now. These buses all attach to
an mi interface attribute "isabus", "eisabus" etc., and the autoconf
framework now allows to specify an interface attribute on config_found()
and config_search(), which limits the search of matching config data
to these which attach to that specific attribute.
So we basically have to call config_found_ia(..., "foobus", ...) where
such a bus is attached.
As a consequence, where a "mainbus" or alike also attaches other
devices (eg CPUs) which do not attach to a specific attribute yet,
we need at least pass an attribute name (different from "foobus") so
that the foo bus is not found at these places. This made some minor
changes necessary which are not obviously related to the mentioned buses.
 1.12 07-May-2004  cl branches: 1.12.2;
Add support for domain0 operations:
- access to all physical memory
- access to hypervisor traps from userland
- setup/config Xen's network routing/firewall rules
 1.11 25-Apr-2004  cl Add support for i386_iopl.
 1.10 24-Apr-2004  cl Add keyboard support and wscons config options.
 1.9 24-Apr-2004  cl Add vga display support.
 1.8 24-Apr-2004  cl Allow the block device driver to impersonate wd/sd/cd devices. This allows
for most system seamless migration from a NetBSD/i386 setup to a NetBSD/xen
setup without changing /etc/fstab or creating additional device nodes.
 1.7 24-Apr-2004  cl Make bus_space map machine addresses instead of physical addresses.
 1.6 24-Apr-2004  cl Consistently use xencons for eveything reffering to Xen's virtual console.

rename arch/xen/xen/console.c -> arch/xen/xen/xencons.c
 1.5 24-Apr-2004  cl Add ``hypervisor at mainbus'' and attach all devices provided by the
hypervisor to it instead of mainbus.

rename arch/xen/i386/hypervisor.c -> arch/xen/i386/hypervisor_machdep.c
 1.4 17-Apr-2004  cl add block device driver
 1.3 25-Mar-2004  wiz branches: 1.3.2;
Backout previous -- this is not enough, config needs to be taught
how to reach partitions above h. Noted by Simon Burge, related to
PR 24905.
 1.2 25-Mar-2004  wiz Define maxpartitions to the same value as MAXPARTITIONS in disklabel.h.
Addresses PR 24905 by Simon Burge.
 1.1 11-Mar-2004  cl Add port to the Xen virtual machine monitor.
(see http://www.cl.cam.ac.uk/Research/SRG/netos/xen/)
 1.3.2.1 22-May-2004  he Pull up revisions 1.4-1.12 (requested by cl in ticket #337):
Upgrade xen support:
- add block device driver
- network device driver bug fixes
- support for vga/keyboard/mouse
- support for domain0 operations
- fix /dev/mem and i386_iopl, reboot, event dispatch
- fix clock support, cpu speed report, lazy fpu switching
- add xen12load loader
- sys/arch/xen parts of build.sh release support
[cl, ticket #337]
 1.12.2.8 11-Dec-2005  christos Sync with head.
 1.12.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.12.2.6 01-Apr-2005  skrll Sync with HEAD.
 1.12.2.5 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.2.4 18-Sep-2004  skrll Sync with HEAD.
 1.12.2.3 03-Sep-2004  skrll Sync with HEAD
 1.12.2.2 03-Aug-2004  skrll Sync with HEAD
 1.12.2.1 07-May-2004  skrll file files.xen was added on branch ktrace-lwp on 2004-08-03 10:43:10 +0000
 1.14.8.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.14.6.1 29-Apr-2005  kent sync with -current
 1.14.4.10 08-Mar-2005  bouyer Add support for ISA bus.
Clean up console attachement, and add support for VGA/pckbc console.
Add support for USB devices, including USB audio (which means others audio
devices should work too)
Add some more generic options to XEN0.
 1.14.4.9 16-Feb-2005  bouyer Glue xen_shm and the block and network backends to the system.
 1.14.4.8 12-Feb-2005  bouyer xen/machmem.c doesn't exists any more.
 1.14.4.7 04-Feb-2005  bouyer Commit to the right branch this time: vfr.c doesn't exists any more.
 1.14.4.6 31-Jan-2005  bouyer First pieces of domain control operations:
- use an up to date xenio.h
- update privcmd.c for newer ioctls (incomplete, some just return an error for
now)
- add a /dev/xenevt pseudo-device, which provide to userland an interface to
xen events
Now xend starts, and basic xm commands (such as list) work.
 1.14.4.5 20-Jan-2005  bouyer bus_dma(9) for xen. Derived from arch/x86/x86/bus_dma.c.
bounce buffers not supported yet, because xen doesn't have an interface
to request memory in a specific range (this means that DMA on ISA won't
be supported), but I've left the code commented out because xen will
likely provide an appropriate hypercall in the future.
 1.14.4.4 19-Jan-2005  bouyer We can't attach {cd,wd,sd} at hypervisor, this conflicts with scsipi.
 1.14.4.3 18-Jan-2005  bouyer snapshot of work in progress on physical devices support:
- support pci at hypervisor. Attach one PCI bus for each bus returned by
PHYSDEVOP_PCI_PROBE_ROOT_BUSES (it looks like xen hides ppb bridges from
the guest OS).
- implement pci_conf_read()/pci_conf_write() using the appropriate
PHYSDEVOP_PCI_* calls.
- call PHYSDEVOP_PCI_INITIALISE_DEVICE from pci_intr_map() to make xen
do interrupts routing if needed, and map the hardware interrupt to
a xen interrupt.
- add pci and associated devices to files.xen

This is enouth to have IDE controllers work in PIO mode.
TODO: bus_dma support (currently bus_dma won't translate pseudo-physical
addresses to machine addresses), ISA support, test memory-mapped
I/O registers.
 1.14.4.2 17-Dec-2004  bouyer Merge changes between 2.0 and -current:
XEN: up to 1.14
files.xen: 1.12 - 1.14
 1.14.4.1 13-Dec-2004  bouyer Commit files from netbsd-2.0-xen-sparse/sys/arch/xen in the Xen-2.0
distribution. These are the files modified from the 2.0 tree to get
NetBSD/xen working with Xen 2.
 1.18.2.12 08-Jan-2007  ghen Pull up following revision(s) (requested by bouyer in ticket #1622):
sys/arch/xen/conf/files.xen: revision 1.49 via patch
sys/arch/xen/i386/autoconf.c: revision 1.19 via patch
sys/arch/xen/conf/files.compat: revision 1.13 via patch
sys/arch/xen/i386/mainbus.c: revision 1.10 via patch
sys/arch/xen/i386/bios32.c: revision 1.1 via patch
sys/arch/i386/conf/XEN2_DOM0: revision 1.9 via patch
sys/arch/xen/i386/locore.S: revision 1.19 via patch
Map the ISA hole on Xen, which allows us to access the SMBios, which allows
us to find the IPMI address. Add IPMI support on Xen (commented out for now)
 1.18.2.11 08-Sep-2006  ghen Pull up following revision(s) (requested by jld in ticket #1499):
sys/arch/xen/conf/files.xen: revision 1.46
sys/arch/xen/xen/hypervisor.c: revision 1.26
sys/arch/xen/xen/shutdown_xenbus.c: revision 1.1
sys/arch/xen/xenbus/xenbus_probe.c: revision 1.13
sys/arch/xen/include/shutdown_xenbus.h: revision 1.1
"xm shutdown" support for xen3. ok'ed by Manuel Bouyer.
 1.18.2.10 05-May-2006  ghen Pull up following revision(s) (requested by bouyer in ticket #1311):
sys/arch/xen/conf/files.xen: revision 1.31 via patch
sys/arch/i386/conf/XEN0: revision 1.18 via patch
Sync with i386/conf/GENERIC:
- add a buch of PCI storage devices
- add firewire devices
- add some missing PCI network devices
- add serial and parallel PCI adapters
- add lpt0 at isa
- add com1 at isa
com0 not added for the benefit of serial console users (it will conflicts
with the Xen kernel).
XXX this means that setups with serial console on com1 will now break with the
default kernel.
Use userconf(4) (add -c to kernel command line) or change your setup to
com0 instead (most bios allows arbitrary mappings of com ports)
 1.18.2.9 07-Apr-2006  tron Apply patch (requested by bouyer in ticket #1245):
Pull up Xen3 domU support. This adds support for the Xen-3 memory bootstrap,
xenstore, and block and network device frontend. Xen-3 support is turned
on by 'options XEN3', which disable Xen-2 support.
Changes affecting non-xen3 specific code:
- xbd and xennet at hypervisor now attaches with xbd_hypervisor and
xennet_hypervisor
- x86_atomic_* renamed to xen_atomic_*
- use genassim.cf to pull in more constant from include files for assembly
- Map the shared info page from locore.S instead of the 0xffffffff hack
in xen_machdep.c
- remove some unused code
- some __asm__ __volatile__ -> __asm volatile and __inline__ -> inline
- more debug code
 1.18.2.8 29-Mar-2006  tron Apply patch (requested by bouyer in ticket #1231):
Add support for ath at pci for XEN domain0.
 1.18.2.7 05-Jan-2006  riz Pull up following revision(s) (requested by bouyer in ticket #1083):
sys/arch/xen/xen/hypervisor.c: revision 1.16
sys/arch/xen/xen/if_xennet.c: revision 1.31
sys/arch/xen/conf/files.xen: revision 1.29
sys/arch/xen/xen/xbd.c: revision 1.22
Define a xendevbus atttibute and add it to hypervisor. Use it for xen devices
which attach to hypervisor. This allows to use config_found_ia() instead of
config_found(), instead of relying on the order of which device are
written in ioconf.c.
From Quentin Garnier.
 1.18.2.6 25-Aug-2005  tron Pull up following revision(s) (requested by bouyer in ticket #696):
sys/arch/xen/x86/xen_bus_dma.c: revision 1.1
sys/arch/xen/include/bus_private.h: revision 1.2
sys/arch/xen/conf/files.xen: revision 1.28
Deal with the machine address space being non-contigous in bus_dmamem_alloc():
- Define _BUS_AVAIL_END to 0xffffffff, as we don't have an easy way to
find the upper bound for our machine address space (and this can change
when we swap pages with the hypervisor).
- implement _xen_bus_dmamem_alloc_range(), which will request a contigous
set of pages to the hypervisor if the pages returned by uvm_pglistalloc()
don't fit the constraints.
We can't deal with the low/high constraints yet, because Xen doesn't offer a
way to get pages in a specific ranges of addresses.
Based on patches from Dave Thompson (in private mail), with heavy hacking
by me.
 1.18.2.5 25-Aug-2005  tron Pull up following revision(s) (requested by bouyer in ticket #694):
sys/arch/xen/xen/hypervisor.c: revision 1.15
sys/arch/xen/xen/evtchn.c: revision 1.16
sys/arch/xen/conf/files.xen: revision 1.27
sys/arch/xen/i386/machdep.c: revision 1.18
Make PCI devices usable for non-domain0 kernels. Based on patches sent by
Ceri Storey to port-xen, with some additionnal changes by me:
- include bus_dma.c, bus_space.c and pci_machdep.c if pci is defined
instead of dom0ops
- Make various initialisations, and probe/attach pci busses based on NPCI
instead of DOM0OPS
- in conf/files.xen, move xen-specific devices before non-xen specific devices
so that the xen-specific match function is called first, to avoid false
attachement from too liberal match function in non-xen code.
 1.18.2.4 18-Aug-2005  tron Pull up revision 1.26 (requested by yamt in ticket #675):
include cardbus/pcmcia.
XXX 32bit cards don't work due to the way how xen handles
pci configuration space.
 1.18.2.3 25-Apr-2005  tron Pull up revision 1.21 (requested by bouyer in ticket #190):
Add sysmon_power attribute to hypervisor, and an handler for CMSG_SHUTDOWN
messages.
Now a NetBSD guest will reboot or shutdown on 'xm shutdown' commands in
domain0.
 1.18.2.2 25-Apr-2005  tron Pull up revision 1.20 (requested by bouyer in ticket #186):
Remove
xenkbc at hypervisor
vga at hypervisor
they have been obsoleted by PCI and ISA support, and don't compile any more.
 1.18.2.1 21-Apr-2005  tron Pull up revision 1.19 (requested by yamt in ticket #175):
tweak x86 bus_dma code so that it can be used by xen port.
- distinguish paddr_t and bus_addr_t.
for xen, use bus_addr_t in the sense of machine address.
- move _X86_BUS_DMA_PRIVATE part of bus.h into bus_private.h.
- remove special handling of xen_shm. we can always grab
machine address from pte.
 1.25.2.9 27-Feb-2008  yamt sync with head.
 1.25.2.8 04-Feb-2008  yamt sync with head.
 1.25.2.7 21-Jan-2008  yamt sync with head
 1.25.2.6 07-Dec-2007  yamt sync with head
 1.25.2.5 27-Oct-2007  yamt sync with head.
 1.25.2.4 03-Sep-2007  yamt sync with head.
 1.25.2.3 26-Feb-2007  yamt sync with head.
 1.25.2.2 30-Dec-2006  yamt sync with head.
 1.25.2.1 21-Jun-2006  yamt sync with head.
 1.30.2.1 22-Nov-2005  yamt sync with head.
 1.32.2.2 18-Feb-2006  yamt sync with head.
 1.32.2.1 01-Feb-2006  yamt sync with head.
 1.33.4.2 01-Jun-2006  kardel Sync with head.
 1.33.4.1 22-Apr-2006  simonb Sync with head.
 1.33.2.1 09-Sep-2006  rpaulo sync with head
 1.34.2.6 11-Aug-2006  yamt sync with head
 1.34.2.5 26-Jun-2006  yamt sync with head.
 1.34.2.4 24-May-2006  yamt sync with head.
 1.34.2.3 11-Apr-2006  yamt sync with head
 1.34.2.2 01-Apr-2006  yamt sync with head.
 1.34.2.1 13-Mar-2006  yamt sync with head.
 1.37.4.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.37.4.1 28-Mar-2006  tron Merge 2006-03-28 NetBSD-current into the "peter-altq" branch.
 1.37.2.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.40.2.1 19-Jun-2006  chap Sync with head.
 1.42.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.45.2.1 08-Sep-2006  rpaulo Pull up following revision(s) (requested by jld in ticket #129):
sys/arch/xen/conf/files.xen: revision 1.46
sys/arch/xen/xen/hypervisor.c: revision 1.26
sys/arch/xen/xen/shutdown_xenbus.c: revision 1.1
sys/arch/xen/xenbus/xenbus_probe.c: revision 1.13
sys/arch/xen/include/shutdown_xenbus.h: revision 1.1
"xm shutdown" support for xen3. ok'ed by Manuel Bouyer.
 1.46.4.2 21-Dec-2006  yamt sync with head.
 1.46.4.1 22-Oct-2006  yamt sync with head
 1.46.2.3 28-Jan-2007  ad xen MD changes.
 1.46.2.2 12-Jan-2007  ad Sync with head.
 1.46.2.1 18-Nov-2006  ad Sync with head.
 1.53.4.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.53.2.1 10-Jun-2007  bouyer Pull up following revision(s) (requested by jld in ticket #711):
sys/arch/xen/xen/clock.c: revision 1.35 via patch
sys/arch/xen/include/types.h: revision 1.5 via patch
sys/arch/xen/i386/machdep.c: revision 1.38 via patch
sys/arch/xen/conf/files.xen: revision 1.60 via patch
sys/arch/xen/include/cpu.h: revision 1.19 via patch
Convert the xen port to use timecounters; ok'ed by bouyer@.
 1.55.2.6 17-May-2007  yamt sync with head.
 1.55.2.5 07-May-2007  yamt sync with head.
 1.55.2.4 15-Apr-2007  yamt sync with head.
 1.55.2.3 26-Mar-2007  yamt adapt xen.
 1.55.2.2 12-Mar-2007  rmind Sync with HEAD.
 1.55.2.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.57.4.1 11-Jul-2007  mjf Sync with head.
 1.57.2.5 03-Dec-2007  ad Sync with HEAD.
 1.57.2.4 09-Oct-2007  ad Sync with head.
 1.57.2.3 15-Jul-2007  ad Sync with head.
 1.57.2.2 27-May-2007  ad Sync with head.
 1.57.2.1 10-Apr-2007  ad Sync with head.
 1.59.2.2 03-Oct-2007  garbled Sync with HEAD
 1.59.2.1 22-May-2007  matt Update to HEAD.
 1.63.12.1 06-Oct-2007  yamt sync with head.
 1.63.10.3 23-Mar-2008  matt sync with HEAD
 1.63.10.2 09-Jan-2008  matt sync with HEAD
 1.63.10.1 06-Nov-2007  matt sync with HEAD
 1.63.8.6 09-Dec-2007  jmcneill Sync with HEAD.
 1.63.8.5 03-Dec-2007  joerg Sync with HEAD.
 1.63.8.4 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.63.8.3 21-Nov-2007  joerg Sync with HEAD.
 1.63.8.2 28-Oct-2007  joerg Sync with HEAD.
 1.63.8.1 02-Oct-2007  joerg Sync with HEAD.
 1.64.2.7 22-Nov-2007  bouyer Sync with HEAD
 1.64.2.6 19-Nov-2007  bouyer Get rid of arch/xenamd64, step 3: merge xenamd64/amd64/xpmap.c in
xen/x86/x86_xpmap.c
 1.64.2.5 19-Nov-2007  bouyer Get rid of arch/xenamd64, step 1: empty xenamd64/conf
- move xenamd64/conf/std.xen to amd64/conf/
- define arch to amd64 amd64/conf/std.xen, and i386 in xen/conf/std.xen
(machine is xen)
- enclose content of amd64/conf/files.amd64 and i386/conf/files.i386 in
ifndef xen/endif, so it can be transparently inclued for xen kernels
- support MACHINE_ARCH=x86_64 in xen/conf/Makefile*
 1.64.2.4 18-Nov-2007  bouyer Sync with HEAD
 1.64.2.3 13-Nov-2007  bouyer Sync with HEAD
 1.64.2.2 21-Oct-2007  bouyer Factorise some Xen pmap code in x86_xpmap.c.
More xpmap_{ptom,mtop} -> xpmap_{ptom,mtop}_masked

The xenamd64 kernel is now good enough to complete a sysinst install from
xennet to xbd.
 1.64.2.1 17-Oct-2007  bouyer Prepare for xenamd64:
- kill xen/i386/identcpu.c, use i386/i386/identcpu.c instead (with a few
#ifndef XEN)
- move some files that can be shared between i386 and amd64 from
xen/i386 to xen/x86 (or to xen/xen for non-cpu-specific code)
- split assembly out of xen/include/hypervisor.h to xen/include/hypercalls.h
- use <xen/...> instead of <machine/...> for cpu-independant include files.

more work needed here, i386-specific files should got out of arch/xen to
arch/xeni386, and more code shared with arch/i386.
 1.68.2.3 18-Feb-2008  mjf Sync with HEAD.
 1.68.2.2 08-Dec-2007  mjf Sync with HEAD.
 1.68.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.75.6.8 19-Jan-2008  bouyer Sync with HEAD
 1.75.6.7 09-Jan-2008  bouyer Merge xen bits to i386/i386/gdt.c. Convert remaining uses of PTE_* macros to
pmap_pte_* macros/inlines.
Fix think-o in pmap.c for native i386.
 1.75.6.6 07-Jan-2008  bouyer Move Xen support to i386/i386/machdep.c. two less files in xen/ :)
 1.75.6.5 06-Jan-2008  bouyer Switch xen/i386 to the i386 npx.c. We have to keep npx_hv.c to attach npx
to hypervisor0.
 1.75.6.4 06-Jan-2008  bouyer Use the i386 bios32.c for xen/i386
 1.75.6.3 05-Jan-2008  bouyer Not used anymore since xen/i386 has been switched to xen_pmap_bootstrap()
 1.75.6.2 02-Jan-2008  bouyer Sync with HEAD
 1.75.6.1 11-Dec-2007  bouyer Switch i386 to x86/x86/pmap.c
 1.82.6.4 17-Jan-2009  mjf Sync with HEAD.
 1.82.6.3 28-Sep-2008  mjf Sync with HEAD.
 1.82.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.82.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.82.2.1 24-Mar-2008  keiichi sync with head.
 1.83.2.1 18-May-2008  yamt sync with head.
 1.84.4.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.84.4.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.84.2.6 11-Aug-2010  yamt sync with head.
 1.84.2.5 11-Mar-2010  yamt sync with head
 1.84.2.4 19-Aug-2009  yamt sync with head.
 1.84.2.3 20-Jun-2009  yamt sync with head
 1.84.2.2 04-May-2009  yamt sync with head.
 1.84.2.1 16-May-2008  yamt sync with head.
 1.87.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.87.4.1 19-Oct-2008  haad Sync with HEAD.
 1.88.4.7 23-Sep-2011  sborrill Pull up the following revisions(s) (requested by jym in ticket #1672):
sys/arch/xen/conf/files.xen: revision 1.123 via patch
sys/arch/xen/xen/hypervisor.c: revision 1.58 via patch
sys/arch/xen/xenbus/xenbus_dev.c: revision 1.9
sys/arch/xen/xenbus/xenbus_probe.c: revision 1.35

Expose Xen kernfs entries inside a domU to make it possible to use pkgsrc's
sysutils/xentools inside a domU to query XenStore entries (or even modify
part of it if the domain has enough rights).
 1.88.4.6 07-Jan-2011  riz Pull up following revision(s) (requested by bouyer in ticket #1503):
sys/arch/xen/conf/files.xen: revision 1.110
Make maxpartitions 16 on !i386. Fixes hardwiring root on device autoconf
index > 0 on amd64. Problem reported and patch tested by Tobias Nygren.
 1.88.4.5 03-Oct-2009  snj Pull up following revision(s) (requested by bouyer in ticket #1054):
sys/arch/xen/conf/files.xen: revision 1.93
sys/arch/xen/include/pci_machdep.h: revision 1.11
sys/arch/xen/include/xen.h: revision 1.31
sys/arch/xen/xen/hypervisor.c: revision 1.44
sys/arch/xen/xen/pci_intr_machdep.c: revision 1.8
sys/arch/xen/xen/pciback.c: revision 1.1
sys/arch/xen/xen/xen_machdep.c: revision 1.5
sys/arch/xen/xen/xpci_xenbus.c: revision 1.1
Work in progress on PCI front-end/back-end support
front-end:
- add a xpci* at xenbus? which provides pci busses from the dom0
xpci provides support routines for PCI config space operations and
enumeration in xpci_xenbus.c
- hypervisor.c: do dom0-style PCI attach only ifdef DOM0OPS
- pci_intr_machdep.c: check line value only if DOM0OPS
back-end:
- add a pciback* at pci? device which takes precedences over all
other PCI devices (match return 500) and matches all devices passed
to pciback.hide option on boot command line.
It exports the PCI device informations to files in /kern/xen/pci/
- hypervisor.c: create /kern/xen earlier so pciback can create its
entries while PCI devices are probed
- xen_machdep.c: add handling for pciback.hide=
frontend is know working on Xen 3.1.x dom0 with ahc(4) and pciide(4)
devices. uhci(4) fail when trying to allocate a large contigous DMA
buffer.
backend is work in progress; support in xentools is not there yet.
 1.88.4.4 19-Jun-2009  snj Pull up following revision(s) (requested by bouyer in ticket #816):
sys/arch/amd64/conf/files.amd64: revision 1.68
sys/arch/i386/conf/files.i386: revision 1.350
sys/arch/x86/include/rtc.h: revision 1.1
sys/arch/x86/isa/clock.c: revision 1.33
sys/arch/x86/isa/rtc.c: revision 1.1
sys/arch/xen/conf/files.xen: revision 1.100
sys/arch/xen/xen/clock.c: revision 1.50 via patch
Split mc146818-related functions from clock.c into rtc.c.
Call rtc_set_ymdhms() from xen/xen/clock.c:xen_rtc_set() for xen3 dom0
kernels as the Xen3 hypervisor doesn't write the new date/time to the CMOS
by itself.
Now a XEN3_DOM0 kernel properly updates the CMOS time.
 1.88.4.3 16-Jun-2009  snj Pull up following revision(s) (requested by rmind in ticket #782):
sys/arch/xen/conf/files.xen: revision 1.99 via patch
Include cpu_topology.c for xen kernels, too.
 1.88.4.2 16-Feb-2009  snj branches: 1.88.4.2.4;
Pull up following revision(s) (requested by ad in ticket #355):
sys/arch/i386/conf/GENERIC_TINY: revision 1.116
sys/arch/i386/conf/INSTALL_TINY: revision 1.122
sys/arch/i386/conf/files.i386: revision 1.341
sys/arch/i386/i386/vm_machdep.c: revision 1.142
sys/arch/i386/include/param.h: revision 1.68
sys/arch/xen/conf/files.xen: revision 1.91
- Kill NOREDZONE.
- Make the redzone conditional on DIAGNOSTIC.
- Give amd64 an additional page for the uarea. 2 is not enough.
 1.88.4.1 22-Jan-2009  snj Pull up following revision(s) (requested by bouyer in ticket #286):
sys/arch/xen/conf/files.xen: revision 1.92
sys/arch/xen/x86/mainbus.c: revision 1.7 via patch
sys/arch/xen/xen/hypervisor.c: revision 1.43
The Xen PCI_BUS_FIXUP/PCI_ADDR_FIXUP has rotted, catch up with x86 changes
in this area. Patch provided by FUKAUMI Naoki in PR#40356.
 1.88.4.2.4.1 21-Apr-2010  matt sync to netbsd-5
 1.88.2.3 28-Apr-2009  skrll Sync with HEAD.
 1.88.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.88.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.92.2.8 27-Aug-2011  jym Sync with HEAD. Most notably: uvm/pmap work done by rmind@, and MP Xen
work of cherry@.

No regression observed on suspend/restore.
 1.92.2.7 02-May-2011  jym Sync with head.
 1.92.2.6 28-Mar-2011  jym 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.
 1.92.2.5 10-Jan-2011  jym Sync with HEAD
 1.92.2.4 24-Oct-2010  jym Sync with HEAD
 1.92.2.3 01-Nov-2009  jym Sync with HEAD.
 1.92.2.2 23-Jul-2009  jym Sync with HEAD.
 1.92.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.106.4.6 31-May-2011  rmind sync with head
 1.106.4.5 21-Apr-2011  rmind sync with head
 1.106.4.4 05-Mar-2011  rmind sync with head
 1.106.4.3 31-May-2010  rmind - Split off Xen versions of pmap_map_ptes/pmap_unmap_ptes into Xen pmap,
also move pmap_apte_flush() with pmap_unmap_apdp() there.
- Make Xen buildable.
 1.106.4.2 30-May-2010  rmind sync with head
 1.106.4.1 18-Mar-2010  rmind Unify /dev/{mem,kmem,zero,null} implementations in MI code. Based on patch
from Joerg Sonnenberger, proposed on tech-kern@, in February 2008.

Work and depression still in progress.
 1.106.2.3 30-Oct-2010  uebayasi Implement pmap_physload_device(9) to replace xmd(4) MD backend.
Implement pmap_mmap(9) and use it from mem(4) and xmd(4).
 1.106.2.2 27-Aug-2010  uebayasi Glue xmd(4).
 1.106.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.110.4.1 05-Mar-2011  bouyer Sync with HEAD
 1.110.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.118.2.3 27-Jun-2011  cherry Conditionally compile xen_ipi.c
 1.118.2.2 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.118.2.1 03-Jun-2011  cherry 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
 1.123.6.2 02-Jun-2012  mrg sync to latest -current.
 1.123.6.1 18-Feb-2012  mrg merge to -current.
 1.123.2.4 22-May-2014  yamt 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")
 1.123.2.3 30-Oct-2012  yamt sync with head
 1.123.2.2 23-May-2012  yamt sync with head.
 1.123.2.1 17-Apr-2012  yamt sync with head
 1.128.2.3 03-Dec-2017  jdolecek update from HEAD
 1.128.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.128.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.129.2.1 18-May-2014  rmind sync with head
 1.133.8.1 18-Jan-2017  skrll Sync with netbsd-5
 1.133.4.3 08-Jul-2017  snj Pull up following revision(s) (requested by khorben in ticket #1445):
sys/arch/amd64/conf/XEN3_DOM0: revision 1.136
sys/arch/i386/conf/XEN3_DOM0: revision 1.113
sys/arch/xen/conf/files.xen: revision 1.148
Register support for SD card readers with Xen DOM0 kernels
Tested on a Lenovo ThinkPad T440s (amd64)
 1.133.4.2 18-Dec-2016  snj Pull up following revision(s) (requested by jnemeth in ticket #1326):
sys/arch/xen/conf/files.xen: revision 1.141
make CPU microcode loading dependent on both DOM0OPS AND CPU_UCODE
 1.133.4.1 25-Sep-2016  bouyer Pull up following revision(s) (requested by sborrill in ticket #1255):
sys/arch/xen/conf/files.xen: revision 1.137
Include files.sljit as i386/amd64 do.
 1.134.2.6 28-Aug-2017  skrll Sync with HEAD
 1.134.2.5 05-Feb-2017  skrll Sync with HEAD
 1.134.2.4 29-May-2016  skrll Sync with HEAD
 1.134.2.3 19-Mar-2016  skrll Sync with HEAD
 1.134.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.134.2.1 06-Apr-2015  skrll Sync with HEAD
 1.141.2.3 26-Apr-2017  pgoyette Sync with HEAD
 1.141.2.2 20-Mar-2017  pgoyette Sync with HEAD
 1.141.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.143.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.147.2.4 05-Aug-2020  martin 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.
 1.147.2.3 23-Sep-2019  martin Backout previous try to fix ticket #1380, this causes more build fallout,
will be fixed differently.
 1.147.2.2 23-Sep-2019  martin Cherry pick a small part of rev1.178 to get efi UUIDs for ticket #1380.
 1.147.2.1 30-Jun-2017  snj Pull up following revision(s) (requested by khorben in ticket #62):
sys/arch/amd64/conf/XEN3_DOM0: revision 1.136
sys/arch/i386/conf/XEN3_DOM0: revision 1.113
sys/arch/xen/conf/files.xen: revision 1.148
Register support for SD card readers with Xen DOM0 kernels
Tested on a Lenovo ThinkPad T440s (amd64)
 1.149.2.2 16-Jul-2017  cherry 2302716
 1.149.2.1 16-Jul-2017  cherry file files.xen was added on branch perseant-stdc-iso10646 on 2017-07-16 14:02:49 +0000
 1.165.2.7 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.165.2.6 14-Sep-2018  pgoyette OMG it builds!

Finish rearranging the amd64 MD compat_netbsd32 code.

XXX Other architectures will be dealt with later.
 1.165.2.5 28-Jul-2018  pgoyette Sync with HEAD
 1.165.2.4 25-Jun-2018  pgoyette Sync with HEAD
 1.165.2.3 22-Mar-2018  pgoyette Synch with HEAD, resolve conflicts
 1.165.2.2 18-Mar-2018  pgoyette Import more christos@ changes from -current
 1.165.2.1 17-Mar-2018  pgoyette Import christos's changes for the compat_60 cpu_ucode stuff
 1.169.2.4 21-Apr-2020  martin Sync with HEAD
 1.169.2.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.169.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.169.2.1 10-Jun-2019  christos Sync with HEAD
 1.178.4.2 15-May-2023  martin Apply patch, requested by manu in ticket #1632:

sys/arch/xen/conf/files.xen (apply patch)

Build fix to define the SELFRELOC option for XEN kernels.
This is not needed in newer branches as those include amd64/conf/files.amd64
from x86/conf/files.x86 (and get the definition via that path)
 1.178.4.1 15-Jul-2020  martin 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.
 1.180.2.9 25-Apr-2020  bouyer restore part accidentaly deleted
 1.180.2.8 25-Apr-2020  bouyer sync with bouyer-xenpvh-base2 (HEAD)
 1.180.2.7 25-Apr-2020  bouyer Include again xen/conf/files.compat for PV kernels, and make it build.
My build.sh -u used stale opt_*.h files ...
 1.180.2.6 20-Apr-2020  bouyer We need xenbus_bus_dma_tag for PVHVM too, but without phys->machine translation
 1.180.2.5 19-Apr-2020  bouyer Move xen_ipi.c to XENPV only.
Make sure we don't need to send events to remote CPUs (outside of IPIs)
 1.180.2.4 16-Apr-2020  bouyer Rename xen/xen/clock.c to xen_clock.c, so that it can be compiled
with x86/isa/clock.c
call events_default_setup() from hypervisor_match to that event
arrays are properly initialised.
Use xen_delay() and xen's timecounter for PVHVM.
 1.180.2.3 16-Apr-2020  bouyer Reorganise sources to make it possible to include Xen PVHVM support in
native kernels. Among others:
- move xen/include/amd64/hypercall.h to amd64/include/xen and
xen/include/i386/hypercall.h to i386/include/xen
- exclude some native files from the build for xenpv
- add xen to "machine" config statement for amd64 and i386
- split arch/xen/conf/files.xen to arch/xen/conf/files.xen (for pv drivers)
and arch/xen/conf/files.xen.pv (for full pv support)
- add GENERIC_XENHVM kernel config which includes GENERIC and add Xen PV
drivers.
 1.180.2.2 14-Apr-2020  bouyer Always patch spllower with cx8_spllower; it works fine for Xen now
Include x86/x86/patch.c is !xenpv
While there, defopt XENPV
 1.180.2.1 11-Apr-2020  bouyer Move softint and preemtion-related functions out of x86/x86/intr.c to
its own file, x86/x86/x86_softintr.c
Add x86/x86/x86_softintr.c for native and XenPV
Make sure XenPV also check ci_ioending, which is used for softints.
Switch XenPV to fast softints and allow kernel preemption.
kpreempt_disable() before calling pmap_changeprot_local()
run xen_wallclock_time() and xen_global_systime_ns() at splshed() to
avoid being interrupted.

XXX amd64 lock stubs are racy for XPENDING
 1.187.4.1 18-Oct-2023  martin Pull up following revision(s) (requested by bouyer in ticket #428):

sys/arch/xen/xen/xen_machdep.c: revision 1.28
sys/arch/x86/pci/pci_machdep.c: revision 1.97
sys/arch/xen/xen/genfb_xen.c: revision 1.1
sys/arch/xen/xen/genfb_xen.c: revision 1.2
sys/arch/xen/include/hypervisor.h: revision 1.59
sys/arch/i386/conf/XEN3PAE_DOM0: revision 1.41 (patch)
sys/arch/x86/x86/genfb_machdep.c: revision 1.22
sys/arch/xen/x86/consinit.c: revision 1.18
sys/arch/xen/x86/autoconf.c: revision 1.26
sys/external/mit/xen-include-public/dist/xen/include/public/platform.h: revision 1.2
sys/arch/xen/conf/files.xen: revision 1.188
sys/arch/x86/x86/consinit.c: revision 1.37
sys/arch/xen/conf/files.xen: revision 1.189
sys/arch/x86/x86/consinit.c: revision 1.38
sys/external/mit/xen-include-public/dist/xen/include/public/xen.h: revision 1.2
sys/arch/x86/include/genfb_machdep.h: revision 1.7
sys/arch/xen/x86/pvh_consinit.c: revision 1.5
sys/arch/xen/x86/pvh_consinit.c: revision 1.6
sys/arch/amd64/conf/XEN3_DOM0: revision 1.201

Move the pvh_xencons so xen_machdep.c as early_xencons, so it can be
used in the future as early ouput for plain PV guests too.

Support non-VGA framebuffers for Xen dom0. This is mandatory for graphic
console on EFI-only hardware.

Add a xen_genfb_getbtinfo() function which will return a btinfo_framebuffer
structure, filled in with parameters provided by Xen

when runing as a Xen dom0, call xen_genfb_getbtinfo() instead of
lookup_bootinfo(BTINFO_FRAMEBUFFER) when adding properties to the
PCI graphic device (when genfb is attached) and in x86_genfb_init()
when genfb is used as console.

x86/x86/consinit.c: If running as a Xen dom0, use xen_genfb_getbtinfo()
to check if we have a genfb console

xen/x86/consinit.c: support genfb as possible console

xen/x86/consinit.c: use the hypervior IO as console until a better one
is found. If the hypervisor is using a serial port for boot messages,
we'll get NetBSD's boot message on the serial port too until
the real console takes over.

xen/x86/autoconf.c: rework device_register() to be closer to the x86 version.
Especially make sure that device_pci_register() is called.

Make sure to always fall back to xen_early_console, even for dom0

Enable genfb in DOM0 kernels

Add ext_lfb_base to dom0_vga_console_info, from recent Xen. We know if it's
present or not by checking dom0.info_size

Add XENPF_get_dom0_console, which gets a dom0_vga_console_info stucture
from the hypervisor. To be used by PVH dom0 kernels.

XENPVH option is not used. Fix consinit.c to use XENPVHVM as intended
and XENPVH from defflag
for a dom0 PVH, the dom0_vga_console_info structure has to be retrieved
using a platform hypercall; do so in the XENPVHVM case.

Now genfb works in a PVH dom0 running on Xen 4.18 (Xen 4.15 doesn't support
this platoform op, so no way to make it work here).
 1.3 05-May-2020  bouyer Make DOM0OPS build for PVH/PVHVM too
 1.2 25-Apr-2020  bouyer 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
 1.1 16-Apr-2020  bouyer branches: 1.1.2;
file files.xen.pv was initially added on branch bouyer-xenpvh.
 1.1.2.5 25-Apr-2020  bouyer Include again xen/conf/files.compat for PV kernels, and make it build.
My build.sh -u used stale opt_*.h files ...
 1.1.2.4 20-Apr-2020  bouyer We need xenbus_bus_dma_tag for PVHVM too, but without phys->machine translation
 1.1.2.3 19-Apr-2020  bouyer Move xen_ipi.c to XENPV only.
Make sure we don't need to send events to remote CPUs (outside of IPIs)
 1.1.2.2 16-Apr-2020  bouyer Rename xen/xen/clock.c to xen_clock.c, so that it can be compiled
with x86/isa/clock.c
call events_default_setup() from hypervisor_match to that event
arrays are properly initialised.
Use xen_delay() and xen's timecounter for PVHVM.
 1.1.2.1 16-Apr-2020  bouyer Reorganise sources to make it possible to include Xen PVHVM support in
native kernels. Among others:
- move xen/include/amd64/hypercall.h to amd64/include/xen and
xen/include/i386/hypercall.h to i386/include/xen
- exclude some native files from the build for xenpv
- add xen to "machine" config statement for amd64 and i386
- split arch/xen/conf/files.xen to arch/xen/conf/files.xen (for pv drivers)
and arch/xen/conf/files.xen.pv (for full pv support)
- add GENERIC_XENHVM kernel config which includes GENERIC and add Xen PV
drivers.
 1.3 28-May-2006  bouyer Remove unused file. Pointed out by Pavel Cahyna.
Probably unused since kernel config files were moved to i386/conf.
 1.2 11-Dec-2005  christos branches: 1.2.4; 1.2.6; 1.2.8; 1.2.14;
merge ktrace-lwp.
 1.1 11-Mar-2004  cl branches: 1.1.4; 1.1.18; 1.1.20;
Add port to the Xen virtual machine monitor.
(see http://www.cl.cam.ac.uk/Research/SRG/netos/xen/)
 1.1.20.1 21-Jun-2006  yamt sync with head.
 1.1.18.1 05-Aug-2006  ghen Pull up following revision(s) (requested by bouyer in ticket #1453):
sys/arch/xen/conf/kern.ldscript: file removal
Remove unused file. Pointed out by Pavel Cahyna.
Probably unused since kernel config files were moved to i386/conf.
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 11-Mar-2004  skrll file kern.ldscript was added on branch ktrace-lwp on 2004-08-03 10:43:10 +0000
 1.2.14.1 19-Jun-2006  chap Sync with head.
 1.2.8.1 26-Jun-2006  yamt sync with head.
 1.2.6.1 01-Jun-2006  kardel Sync with head.
 1.2.4.1 09-Sep-2006  rpaulo sync with head
 1.2 11-Mar-2005  bouyer Define xen devices in i386/conf/majors.i386. This makes sure there won't
be conflics with regular i386 kernels.
 1.1 11-Mar-2004  cl branches: 1.1.4; 1.1.12; 1.1.14;
Add port to the Xen virtual machine monitor.
(see http://www.cl.cam.ac.uk/Research/SRG/netos/xen/)
 1.1.14.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.1.12.1 29-Apr-2005  kent sync with -current
 1.1.4.5 01-Apr-2005  skrll Sync with HEAD.
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 11-Mar-2004  skrll file majors.i386 was added on branch ktrace-lwp on 2004-08-03 10:43:10 +0000
 1.5 11-Mar-2005  bouyer Define xen devices in i386/conf/majors.i386. This makes sure there won't
be conflics with regular i386 kernels.
 1.4 09-Mar-2005  bouyer Merge the bouyer-xen2 branch. This add supports for the Xen 2.0 virtual
machine kernel (both privileged and non-privileged domains), and remove support
for the old xen 1.2.
 1.3 24-Apr-2004  cl branches: 1.3.2; 1.3.6; 1.3.8; 1.3.10;
Consistently use xencons for eveything reffering to Xen's virtual console.

rename arch/xen/xen/console.c -> arch/xen/xen/xencons.c
 1.2 17-Apr-2004  cl add block device driver
 1.1 11-Mar-2004  cl branches: 1.1.2;
Add port to the Xen virtual machine monitor.
(see http://www.cl.cam.ac.uk/Research/SRG/netos/xen/)
 1.1.2.1 22-May-2004  he Pull up revisions 1.2-1.3 (requested by cl in ticket #337):
Upgrade xen support:
- add block device driver
- network device driver bug fixes
- support for vga/keyboard/mouse
- support for domain0 operations
- fix /dev/mem and i386_iopl, reboot, event dispatch
- fix clock support, cpu speed report, lazy fpu switching
- add xen12load loader
- sys/arch/xen parts of build.sh release support
[cl, ticket #337]
 1.3.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.8.1 29-Apr-2005  kent sync with -current
 1.3.6.1 31-Jan-2005  bouyer First pieces of domain control operations:
- use an up to date xenio.h
- update privcmd.c for newer ioctls (incomplete, some just return an error for
now)
- add a /dev/xenevt pseudo-device, which provide to userland an interface to
xen events
Now xend starts, and basic xm commands (such as list) work.
 1.3.2.5 01-Apr-2005  skrll Sync with HEAD.
 1.3.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.3.2.2 03-Aug-2004  skrll Sync with HEAD
 1.3.2.1 24-Apr-2004  skrll file majors.xen was added on branch ktrace-lwp on 2004-08-03 10:43:10 +0000
 1.11 09-Apr-2020  jdolecek move xen/conf/std.xen to i386/conf/std.xen, it's i386-specific

split off __XEN_INTERFACE_VERSION__ to new xen/conf/std.xenversion
and use from both i386/conf/std.xen and amd64/conf/stf.xen, so that
there is single place for the definition
 1.10 04-Feb-2019  cherry branches: 1.10.10;
Bump up XEN source API compatibility to 0x00030208 from 0x00030201,

but maintain backwards source API compilation compatibility.

ie; sources with config(5)
options __XEN_INTERFACE_VERSION__=0x00030201 # Xen 3.1 interface

should compile and run without problems.

Not that API version 0x00030201 is the lowest version we support now.
 1.9 02-Feb-2019  cherry 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/
 1.8 23-Sep-2016  joerg branches: 1.8.16;
Given Xen/i386 the same process and file limit as native i386.
 1.7 30-Jun-2011  wiz branches: 1.7.12; 1.7.28; 1.7.30; 1.7.32; 1.7.34; 1.7.36;
dependant -> dependent
 1.6 12-Dec-2008  alc branches: 1.6.2; 1.6.12;
include standard HAL option.

Fix build breaks reported by Paul Goyette on current-users@
 1.5 25-Jan-2008  joerg branches: 1.5.6; 1.5.10; 1.5.16; 1.5.18; 1.5.20; 1.5.26;
Refactor in_cksum/in4_cksum/in6_cksum implementations:
- All three functions are included in the kernel by default.
They call a backend function cpu_in_cksum after possibly
computing the checksum of the pseudo header.
- cpu_in_cksum is the core to implement the one-complement sum.
The default implementation is moderate fast on most platforms
and provides a 32bit accumulator with 16bit addends for L32 platforms
and a 64bit accumulator with 32bit addends for L64 platforms.
It handles edge cases like very large mbuf chains (could happen with
native IPv6 in the future) and provides a good base for new native
implementations.
- Modify i386 and amd64 assembly to use the new interface.

This disables the MD implementations on !x86 until the conversion is
done. For Alpha, the portable version is faster.
 1.4 22-Nov-2007  bouyer Pull up the bouyer-xenamd64 branch to HEAD. This brings in amd64 support
to NetBSD/Xen, both Dom0 and DomU.
 1.3 11-Dec-2005  christos branches: 1.3.30; 1.3.48; 1.3.50; 1.3.54; 1.3.56;
merge ktrace-lwp.
 1.2 17-Sep-2005  yamt include "conf/std".
 1.1 11-Mar-2004  cl branches: 1.1.4; 1.1.20;
Add port to the Xen virtual machine monitor.
(see http://www.cl.cam.ac.uk/Research/SRG/netos/xen/)
 1.1.20.3 04-Feb-2008  yamt sync with head.
 1.1.20.2 07-Dec-2007  yamt sync with head
 1.1.20.1 21-Jun-2006  yamt sync with head.
 1.1.4.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 11-Mar-2004  skrll file std.xen was added on branch ktrace-lwp on 2004-08-03 10:43:10 +0000
 1.3.56.2 18-Feb-2008  mjf Sync with HEAD.
 1.3.56.1 08-Dec-2007  mjf Sync with HEAD.
 1.3.54.1 19-Nov-2007  bouyer Get rid of arch/xenamd64, step 1: empty xenamd64/conf
- move xenamd64/conf/std.xen to amd64/conf/
- define arch to amd64 amd64/conf/std.xen, and i386 in xen/conf/std.xen
(machine is xen)
- enclose content of amd64/conf/files.amd64 and i386/conf/files.i386 in
ifndef xen/endif, so it can be transparently inclued for xen kernels
- support MACHINE_ARCH=x86_64 in xen/conf/Makefile*
 1.3.50.2 23-Mar-2008  matt sync with HEAD
 1.3.50.1 09-Jan-2008  matt sync with HEAD
 1.3.48.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.3.30.1 03-Dec-2007  ad Sync with HEAD.
 1.5.26.1 21-Apr-2010  matt sync to netbsd-5
 1.5.20.1 07-Aug-2009  snj Apply patch (requested by jmcneill in ticket 775):
Update to the open source atheros HAL.
 1.5.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.5.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.5.10.1 04-May-2009  yamt sync with head.
 1.5.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.6.12.1 31-Jul-2011  cherry grow MP support for i386. boots to single user
 1.6.2.1 27-Aug-2011  jym Sync with HEAD. Most notably: uvm/pmap work done by rmind@, and MP Xen
work of cherry@.

No regression observed on suspend/restore.
 1.7.36.1 18-Jan-2017  skrll Sync with netbsd-5
 1.7.34.1 04-Nov-2016  pgoyette Sync with HEAD
 1.7.32.1 01-Nov-2016  snj Pull up following revision(s) (requested by joerg in ticket #1258):
sys/arch/amd64/conf/std.xen: revision 1.8
sys/arch/xen/conf/std.xen: revision 1.8
Use the same process and file limits as normal AND64 for Xen kernels.
Given Xen/i386 the same process and file limit as native i386.
 1.7.30.1 05-Oct-2016  skrll Sync with HEAD
 1.7.28.1 01-Nov-2016  snj Pull up following revision(s) (requested by joerg in ticket #1258):
sys/arch/amd64/conf/std.xen: revision 1.8
sys/arch/xen/conf/std.xen: revision 1.8
Use the same process and file limits as normal AND64 for Xen kernels.
Given Xen/i386 the same process and file limit as native i386.
 1.7.12.1 03-Dec-2017  jdolecek update from HEAD
 1.8.16.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.8.16.1 10-Jun-2019  christos Sync with HEAD
 1.10.10.2 20-Apr-2020  bouyer Sync with HEAD
 1.10.10.1 16-Apr-2020  bouyer Reorganise sources to make it possible to include Xen PVHVM support in
native kernels. Among others:
- move xen/include/amd64/hypercall.h to amd64/include/xen and
xen/include/i386/hypercall.h to i386/include/xen
- exclude some native files from the build for xenpv
- add xen to "machine" config statement for amd64 and i386
- split arch/xen/conf/files.xen to arch/xen/conf/files.xen (for pv drivers)
and arch/xen/conf/files.xen.pv (for full pv support)
- add GENERIC_XENHVM kernel config which includes GENERIC and add Xen PV
drivers.
 1.3 25-Apr-2020  bouyer 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
 1.2 09-Apr-2020  jdolecek branches: 1.2.2; 1.2.4;
update to __XEN_INTERFACE_VERSION__ 0x0003020a aka Xen 3.2.10

this brings grant memory v2 support:
- status separated from flags - revoking access needs just memory barrier,
no need for expensive cmpxchg16 any more
- sub-page hypervisor copy-only grants, to be used by xennet(4)
- 64-bit frame, i.e. support for DomU RAM >16TB

the grant table is now always allocated on boot to maximum size, it's now
never grown in runtime; switch back to regular kmem_alloc()/kmem_free()

code now requires v2 support, no compatibility for grant version 1 retained -
Xen v2 support predates all currently supported Xen versions

also interface for baloon changed slightly, code updated
 1.1 09-Apr-2020  jdolecek move xen/conf/std.xen to i386/conf/std.xen, it's i386-specific

split off __XEN_INTERFACE_VERSION__ to new xen/conf/std.xenversion
and use from both i386/conf/std.xen and amd64/conf/stf.xen, so that
there is single place for the definition
 1.2.4.2 20-Apr-2020  bouyer Sync with HEAD
 1.2.4.1 09-Apr-2020  bouyer file std.xenversion was added on branch bouyer-xenpvh on 2020-04-20 11:29:00 +0000
 1.2.2.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.2.2.1 09-Apr-2020  martin file std.xenversion was added on branch phil-wifi on 2020-04-13 08:04:12 +0000

RSS XML Feed