History log of /netbsd-current/sys/arch/xen/conf/files.xen
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 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.


Revision tags: netbsd-10-base bouyer-sunxi-drm-base
# 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.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 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


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421
# 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.


Revision tags: bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 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


Revision tags: is-mlppp-base ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
# 1.179 07-Sep-2019 maxv

Merge amd64func.S into cpufunc.S, and clean up.


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 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


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 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.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728
# 1.170 26-Jul-2018 maxv

Merge the content of xen_debug.c into xen_machdep.c, there is only one
function.


Revision tags: phil-wifi-base pgoyette-compat-0625
# 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.


Revision tags: pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322
# 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)


Revision tags: pgoyette-compat-0315 pgoyette-compat-base
# 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


Revision tags: tls-maxphys-base-20171202
# 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


Revision tags: nick-nhusb-base-20170825
# 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.


Revision tags: perseant-stdc-iso10646-base
# 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)


Revision tags: netbsd-8-base
# 1.147 23-May-2017 nonaka

branches: 1.147.2;
x86: hypervisor detection from FreeBSD for x2APIC support.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.146 24-Mar-2017 maxv

Don't compile PMCs on Xen.


Revision tags: pgoyette-localcount-20170320
# 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.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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>


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.141 20-May-2016 jnemeth

branches: 1.141.2;
make CPU microcode loading dependent on both DOM0OPS AND CPU_UCODE


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 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


Revision tags: nick-nhusb-base-20151226
# 1.138 11-Nov-2015 skrll

Fix XEN build - does XEN really want/need pmap_pv_track?


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base
# 1.134 11-Oct-2014 uebayasi

branches: 1.134.2;
Mark machdep files.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 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!


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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@


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase
# 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.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 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.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 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.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3
# 1.99 30-Apr-2009 pgoyette

Include cpu_topology.c for xen kernels, too.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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.


Revision tags: mjf-devfs2-base
# 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.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 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.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 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.


Revision tags: yamt-nfs-mp-base
# 1.84 25-Apr-2008 ad

branches: 1.84.2; 1.84.4;
Include null IPI functions if !MULTIPROCESSOR.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.83 27-Feb-2008 dogcow

branches: 1.83.2;
fix longrun build borkage on i386


Revision tags: nick-net80211-sync-base
# 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.


Revision tags: mjf-devfs-base
# 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.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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.


Revision tags: matt-armv6-base
# 1.76 01-Jan-2008 yamt

try to detect processor resource sharing topologies. ie. package/core/smt IDs.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: bouyer-xenamd64-base
# 1.70 22-Nov-2007 yamt

remove lock_machdep.c


Revision tags: bouyer-xenamd64-base2
# 1.69 15-Nov-2007 ad

Remove support for 80386 level CPUs. PR port-i386/36163.


Revision tags: jmcneill-base
# 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.


Revision tags: yamt-x86pmap-base4
# 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.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 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.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 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.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 1.56 18-Feb-2007 dsl

Get config(1) to supply the default values for BEEP_ONHALT.


Revision tags: post-newlock2-merge
# 1.55 09-Feb-2007 ad

branches: 1.55.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 newlock2-base
# 1.54 18-Dec-2006 gdt

Use agp_machdep.c from the new location (x86, not i386).


Revision tags: yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 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@.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.46 11-Aug-2006 yamt

branches: 1.46.2; 1.46.4;
"xm shutdown" support for xen3. ok'ed by Manuel Bouyer.


Revision tags: abandoned-netbsd-4-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 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.


Revision tags: yamt-pdpolicy-base5
# 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.


Revision tags: yamt-pdpolicy-base4 elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base3
# 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().


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 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.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 ktrace-lwp-base
# 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)


Revision tags: yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base
# 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.


Revision tags: yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 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


Revision tags: kent-audio2-base
# 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.


Revision tags: yamt-km-base4 yamt-km-base3 netbsd-3-base
# 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.


Revision tags: yamt-km-base2
# 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.


Revision tags: yamt-km-base kent-audio1-beforemerge bouyer-xen2-base kent-audio1-base
# 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


Revision tags: netbsd-2-0-base
# 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.187 31-Aug-2022 bouyer

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.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 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


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421
# 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.


Revision tags: bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 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


Revision tags: is-mlppp-base ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
# 1.179 07-Sep-2019 maxv

Merge amd64func.S into cpufunc.S, and clean up.


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 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


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 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.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728
# 1.170 26-Jul-2018 maxv

Merge the content of xen_debug.c into xen_machdep.c, there is only one
function.


Revision tags: phil-wifi-base pgoyette-compat-0625
# 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.


Revision tags: pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322
# 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)


Revision tags: pgoyette-compat-0315 pgoyette-compat-base
# 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


Revision tags: tls-maxphys-base-20171202
# 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


Revision tags: nick-nhusb-base-20170825
# 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.


Revision tags: perseant-stdc-iso10646-base
# 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)


Revision tags: netbsd-8-base
# 1.147 23-May-2017 nonaka

branches: 1.147.2;
x86: hypervisor detection from FreeBSD for x2APIC support.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.146 24-Mar-2017 maxv

Don't compile PMCs on Xen.


Revision tags: pgoyette-localcount-20170320
# 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.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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>


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.141 20-May-2016 jnemeth

branches: 1.141.2;
make CPU microcode loading dependent on both DOM0OPS AND CPU_UCODE


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 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


Revision tags: nick-nhusb-base-20151226
# 1.138 11-Nov-2015 skrll

Fix XEN build - does XEN really want/need pmap_pv_track?


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base
# 1.134 11-Oct-2014 uebayasi

branches: 1.134.2;
Mark machdep files.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 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!


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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@


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase
# 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.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 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.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 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.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3
# 1.99 30-Apr-2009 pgoyette

Include cpu_topology.c for xen kernels, too.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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.


Revision tags: mjf-devfs2-base
# 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.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 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.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 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.


Revision tags: yamt-nfs-mp-base
# 1.84 25-Apr-2008 ad

branches: 1.84.2; 1.84.4;
Include null IPI functions if !MULTIPROCESSOR.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.83 27-Feb-2008 dogcow

branches: 1.83.2;
fix longrun build borkage on i386


Revision tags: nick-net80211-sync-base
# 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.


Revision tags: mjf-devfs-base
# 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.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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.


Revision tags: matt-armv6-base
# 1.76 01-Jan-2008 yamt

try to detect processor resource sharing topologies. ie. package/core/smt IDs.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: bouyer-xenamd64-base
# 1.70 22-Nov-2007 yamt

remove lock_machdep.c


Revision tags: bouyer-xenamd64-base2
# 1.69 15-Nov-2007 ad

Remove support for 80386 level CPUs. PR port-i386/36163.


Revision tags: jmcneill-base
# 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.


Revision tags: yamt-x86pmap-base4
# 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.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 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.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 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.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 1.56 18-Feb-2007 dsl

Get config(1) to supply the default values for BEEP_ONHALT.


Revision tags: post-newlock2-merge
# 1.55 09-Feb-2007 ad

branches: 1.55.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 newlock2-base
# 1.54 18-Dec-2006 gdt

Use agp_machdep.c from the new location (x86, not i386).


Revision tags: yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 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@.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.46 11-Aug-2006 yamt

branches: 1.46.2; 1.46.4;
"xm shutdown" support for xen3. ok'ed by Manuel Bouyer.


Revision tags: abandoned-netbsd-4-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 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.


Revision tags: yamt-pdpolicy-base5
# 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.


Revision tags: yamt-pdpolicy-base4 elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base3
# 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().


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 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.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 ktrace-lwp-base
# 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)


Revision tags: yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base
# 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.


Revision tags: yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 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


Revision tags: kent-audio2-base
# 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.


Revision tags: yamt-km-base4 yamt-km-base3 netbsd-3-base
# 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.


Revision tags: yamt-km-base2
# 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.


Revision tags: yamt-km-base kent-audio1-beforemerge bouyer-xen2-base kent-audio1-base
# 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


Revision tags: netbsd-2-0-base
# 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.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


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421
# 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.


Revision tags: bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 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


Revision tags: is-mlppp-base ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
# 1.179 07-Sep-2019 maxv

Merge amd64func.S into cpufunc.S, and clean up.


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.178 14-Feb-2019 cherry

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


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 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.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728
# 1.170 26-Jul-2018 maxv

Merge the content of xen_debug.c into xen_machdep.c, there is only one
function.


Revision tags: phil-wifi-base pgoyette-compat-0625
# 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.


Revision tags: pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322
# 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)


Revision tags: pgoyette-compat-0315 pgoyette-compat-base
# 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


Revision tags: tls-maxphys-base-20171202
# 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


Revision tags: nick-nhusb-base-20170825
# 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.


Revision tags: perseant-stdc-iso10646-base
# 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)


Revision tags: netbsd-8-base
# 1.147 23-May-2017 nonaka

branches: 1.147.2;
x86: hypervisor detection from FreeBSD for x2APIC support.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.146 24-Mar-2017 maxv

Don't compile PMCs on Xen.


Revision tags: pgoyette-localcount-20170320
# 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.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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>


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.141 20-May-2016 jnemeth

branches: 1.141.2;
make CPU microcode loading dependent on both DOM0OPS AND CPU_UCODE


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 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


Revision tags: nick-nhusb-base-20151226
# 1.138 11-Nov-2015 skrll

Fix XEN build - does XEN really want/need pmap_pv_track?


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base
# 1.134 11-Oct-2014 uebayasi

branches: 1.134.2;
Mark machdep files.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 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!


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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@


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase
# 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.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 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.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 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.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3
# 1.99 30-Apr-2009 pgoyette

Include cpu_topology.c for xen kernels, too.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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.


Revision tags: mjf-devfs2-base
# 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.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 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.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 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.


Revision tags: yamt-nfs-mp-base
# 1.84 25-Apr-2008 ad

branches: 1.84.2; 1.84.4;
Include null IPI functions if !MULTIPROCESSOR.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.83 27-Feb-2008 dogcow

branches: 1.83.2;
fix longrun build borkage on i386


Revision tags: nick-net80211-sync-base
# 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.


Revision tags: mjf-devfs-base
# 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.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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.


Revision tags: matt-armv6-base
# 1.76 01-Jan-2008 yamt

try to detect processor resource sharing topologies. ie. package/core/smt IDs.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: bouyer-xenamd64-base
# 1.70 22-Nov-2007 yamt

remove lock_machdep.c


Revision tags: bouyer-xenamd64-base2
# 1.69 15-Nov-2007 ad

Remove support for 80386 level CPUs. PR port-i386/36163.


Revision tags: jmcneill-base
# 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.


Revision tags: yamt-x86pmap-base4
# 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.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 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.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 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.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 1.56 18-Feb-2007 dsl

Get config(1) to supply the default values for BEEP_ONHALT.


Revision tags: post-newlock2-merge
# 1.55 09-Feb-2007 ad

branches: 1.55.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 newlock2-base
# 1.54 18-Dec-2006 gdt

Use agp_machdep.c from the new location (x86, not i386).


Revision tags: yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 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@.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.46 11-Aug-2006 yamt

branches: 1.46.2; 1.46.4;
"xm shutdown" support for xen3. ok'ed by Manuel Bouyer.


Revision tags: abandoned-netbsd-4-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 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.


Revision tags: yamt-pdpolicy-base5
# 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.


Revision tags: yamt-pdpolicy-base4 elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base3
# 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().


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 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.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 ktrace-lwp-base
# 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)


Revision tags: yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base
# 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.


Revision tags: yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 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


Revision tags: kent-audio2-base
# 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.


Revision tags: yamt-km-base4 yamt-km-base3 netbsd-3-base
# 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.


Revision tags: yamt-km-base2
# 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.


Revision tags: yamt-km-base kent-audio1-beforemerge bouyer-xen2-base kent-audio1-base
# 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


Revision tags: netbsd-2-0-base
# 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.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


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421
# 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.


Revision tags: bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 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


Revision tags: is-mlppp-base ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
# 1.179 07-Sep-2019 maxv

Merge amd64func.S into cpufunc.S, and clean up.


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.178 14-Feb-2019 cherry

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


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 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.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728
# 1.170 26-Jul-2018 maxv

Merge the content of xen_debug.c into xen_machdep.c, there is only one
function.


Revision tags: phil-wifi-base pgoyette-compat-0625
# 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.


Revision tags: pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322
# 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)


Revision tags: pgoyette-compat-0315 pgoyette-compat-base
# 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


Revision tags: tls-maxphys-base-20171202
# 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


Revision tags: nick-nhusb-base-20170825
# 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.


Revision tags: perseant-stdc-iso10646-base
# 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)


Revision tags: netbsd-8-base
# 1.147 23-May-2017 nonaka

branches: 1.147.2;
x86: hypervisor detection from FreeBSD for x2APIC support.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.146 24-Mar-2017 maxv

Don't compile PMCs on Xen.


Revision tags: pgoyette-localcount-20170320
# 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.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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>


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.141 20-May-2016 jnemeth

branches: 1.141.2;
make CPU microcode loading dependent on both DOM0OPS AND CPU_UCODE


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 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


Revision tags: nick-nhusb-base-20151226
# 1.138 11-Nov-2015 skrll

Fix XEN build - does XEN really want/need pmap_pv_track?


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base
# 1.134 11-Oct-2014 uebayasi

branches: 1.134.2;
Mark machdep files.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 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!


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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@


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase
# 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.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 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.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 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.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3
# 1.99 30-Apr-2009 pgoyette

Include cpu_topology.c for xen kernels, too.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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.


Revision tags: mjf-devfs2-base
# 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.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 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.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 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.


Revision tags: yamt-nfs-mp-base
# 1.84 25-Apr-2008 ad

branches: 1.84.2; 1.84.4;
Include null IPI functions if !MULTIPROCESSOR.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.83 27-Feb-2008 dogcow

branches: 1.83.2;
fix longrun build borkage on i386


Revision tags: nick-net80211-sync-base
# 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.


Revision tags: mjf-devfs-base
# 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.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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.


Revision tags: matt-armv6-base
# 1.76 01-Jan-2008 yamt

try to detect processor resource sharing topologies. ie. package/core/smt IDs.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: bouyer-xenamd64-base
# 1.70 22-Nov-2007 yamt

remove lock_machdep.c


Revision tags: bouyer-xenamd64-base2
# 1.69 15-Nov-2007 ad

Remove support for 80386 level CPUs. PR port-i386/36163.


Revision tags: jmcneill-base
# 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.


Revision tags: yamt-x86pmap-base4
# 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.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 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.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 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.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 1.56 18-Feb-2007 dsl

Get config(1) to supply the default values for BEEP_ONHALT.


Revision tags: post-newlock2-merge
# 1.55 09-Feb-2007 ad

branches: 1.55.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 newlock2-base
# 1.54 18-Dec-2006 gdt

Use agp_machdep.c from the new location (x86, not i386).


Revision tags: yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 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@.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.46 11-Aug-2006 yamt

branches: 1.46.2; 1.46.4;
"xm shutdown" support for xen3. ok'ed by Manuel Bouyer.


Revision tags: abandoned-netbsd-4-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 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.


Revision tags: yamt-pdpolicy-base5
# 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.


Revision tags: yamt-pdpolicy-base4 elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base3
# 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().


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 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.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 ktrace-lwp-base
# 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)


Revision tags: yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base
# 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.


Revision tags: yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 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


Revision tags: kent-audio2-base
# 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.


Revision tags: yamt-km-base4 yamt-km-base3 netbsd-3-base
# 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.


Revision tags: yamt-km-base2
# 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.


Revision tags: yamt-km-base kent-audio1-beforemerge bouyer-xen2-base kent-audio1-base
# 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


Revision tags: netbsd-2-0-base
# 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.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


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421
# 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.


Revision tags: bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 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


Revision tags: is-mlppp-base ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
# 1.179 07-Sep-2019 maxv

Merge amd64func.S into cpufunc.S, and clean up.


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.178 14-Feb-2019 cherry

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


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 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.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728
# 1.170 26-Jul-2018 maxv

Merge the content of xen_debug.c into xen_machdep.c, there is only one
function.


Revision tags: phil-wifi-base pgoyette-compat-0625
# 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.


Revision tags: pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322
# 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)


Revision tags: pgoyette-compat-0315 pgoyette-compat-base
# 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


Revision tags: tls-maxphys-base-20171202
# 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


Revision tags: nick-nhusb-base-20170825
# 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.


Revision tags: perseant-stdc-iso10646-base
# 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)


Revision tags: netbsd-8-base
# 1.147 23-May-2017 nonaka

branches: 1.147.2;
x86: hypervisor detection from FreeBSD for x2APIC support.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.146 24-Mar-2017 maxv

Don't compile PMCs on Xen.


Revision tags: pgoyette-localcount-20170320
# 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.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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>


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.141 20-May-2016 jnemeth

branches: 1.141.2;
make CPU microcode loading dependent on both DOM0OPS AND CPU_UCODE


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 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


Revision tags: nick-nhusb-base-20151226
# 1.138 11-Nov-2015 skrll

Fix XEN build - does XEN really want/need pmap_pv_track?


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base
# 1.134 11-Oct-2014 uebayasi

branches: 1.134.2;
Mark machdep files.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 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!


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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@


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase
# 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.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 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.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 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.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3
# 1.99 30-Apr-2009 pgoyette

Include cpu_topology.c for xen kernels, too.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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.


Revision tags: mjf-devfs2-base
# 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.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 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.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 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.


Revision tags: yamt-nfs-mp-base
# 1.84 25-Apr-2008 ad

branches: 1.84.2; 1.84.4;
Include null IPI functions if !MULTIPROCESSOR.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.83 27-Feb-2008 dogcow

branches: 1.83.2;
fix longrun build borkage on i386


Revision tags: nick-net80211-sync-base
# 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.


Revision tags: mjf-devfs-base
# 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.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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.


Revision tags: matt-armv6-base
# 1.76 01-Jan-2008 yamt

try to detect processor resource sharing topologies. ie. package/core/smt IDs.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: bouyer-xenamd64-base
# 1.70 22-Nov-2007 yamt

remove lock_machdep.c


Revision tags: bouyer-xenamd64-base2
# 1.69 15-Nov-2007 ad

Remove support for 80386 level CPUs. PR port-i386/36163.


Revision tags: jmcneill-base
# 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.


Revision tags: yamt-x86pmap-base4
# 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.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 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.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 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.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 1.56 18-Feb-2007 dsl

Get config(1) to supply the default values for BEEP_ONHALT.


Revision tags: post-newlock2-merge
# 1.55 09-Feb-2007 ad

branches: 1.55.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 newlock2-base
# 1.54 18-Dec-2006 gdt

Use agp_machdep.c from the new location (x86, not i386).


Revision tags: yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 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@.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.46 11-Aug-2006 yamt

branches: 1.46.2; 1.46.4;
"xm shutdown" support for xen3. ok'ed by Manuel Bouyer.


Revision tags: abandoned-netbsd-4-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 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.


Revision tags: yamt-pdpolicy-base5
# 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.


Revision tags: yamt-pdpolicy-base4 elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base3
# 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().


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 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.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 ktrace-lwp-base
# 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)


Revision tags: yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base
# 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.


Revision tags: yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 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


Revision tags: kent-audio2-base
# 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.


Revision tags: yamt-km-base4 yamt-km-base3 netbsd-3-base
# 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.


Revision tags: yamt-km-base2
# 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.


Revision tags: yamt-km-base kent-audio1-beforemerge bouyer-xen2-base kent-audio1-base
# 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


Revision tags: netbsd-2-0-base
# 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.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


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421
# 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.


Revision tags: bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 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


Revision tags: is-mlppp-base ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
# 1.179 07-Sep-2019 maxv

Merge amd64func.S into cpufunc.S, and clean up.


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.178 14-Feb-2019 cherry

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


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 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.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728
# 1.170 26-Jul-2018 maxv

Merge the content of xen_debug.c into xen_machdep.c, there is only one
function.


Revision tags: phil-wifi-base pgoyette-compat-0625
# 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.


Revision tags: pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322
# 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)


Revision tags: pgoyette-compat-0315 pgoyette-compat-base
# 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


Revision tags: tls-maxphys-base-20171202
# 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


Revision tags: nick-nhusb-base-20170825
# 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.


Revision tags: perseant-stdc-iso10646-base
# 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)


Revision tags: netbsd-8-base
# 1.147 23-May-2017 nonaka

branches: 1.147.2;
x86: hypervisor detection from FreeBSD for x2APIC support.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.146 24-Mar-2017 maxv

Don't compile PMCs on Xen.


Revision tags: pgoyette-localcount-20170320
# 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.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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>


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.141 20-May-2016 jnemeth

branches: 1.141.2;
make CPU microcode loading dependent on both DOM0OPS AND CPU_UCODE


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 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


Revision tags: nick-nhusb-base-20151226
# 1.138 11-Nov-2015 skrll

Fix XEN build - does XEN really want/need pmap_pv_track?


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base
# 1.134 11-Oct-2014 uebayasi

branches: 1.134.2;
Mark machdep files.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 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!


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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@


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase
# 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.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 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.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 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.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3
# 1.99 30-Apr-2009 pgoyette

Include cpu_topology.c for xen kernels, too.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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.


Revision tags: mjf-devfs2-base
# 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.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 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.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 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.


Revision tags: yamt-nfs-mp-base
# 1.84 25-Apr-2008 ad

branches: 1.84.2; 1.84.4;
Include null IPI functions if !MULTIPROCESSOR.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.83 27-Feb-2008 dogcow

branches: 1.83.2;
fix longrun build borkage on i386


Revision tags: nick-net80211-sync-base
# 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.


Revision tags: mjf-devfs-base
# 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.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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.


Revision tags: matt-armv6-base
# 1.76 01-Jan-2008 yamt

try to detect processor resource sharing topologies. ie. package/core/smt IDs.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: bouyer-xenamd64-base
# 1.70 22-Nov-2007 yamt

remove lock_machdep.c


Revision tags: bouyer-xenamd64-base2
# 1.69 15-Nov-2007 ad

Remove support for 80386 level CPUs. PR port-i386/36163.


Revision tags: jmcneill-base
# 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.


Revision tags: yamt-x86pmap-base4
# 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.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 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.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 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.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 1.56 18-Feb-2007 dsl

Get config(1) to supply the default values for BEEP_ONHALT.


Revision tags: post-newlock2-merge
# 1.55 09-Feb-2007 ad

branches: 1.55.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 newlock2-base
# 1.54 18-Dec-2006 gdt

Use agp_machdep.c from the new location (x86, not i386).


Revision tags: yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 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@.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.46 11-Aug-2006 yamt

branches: 1.46.2; 1.46.4;
"xm shutdown" support for xen3. ok'ed by Manuel Bouyer.


Revision tags: abandoned-netbsd-4-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 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.


Revision tags: yamt-pdpolicy-base5
# 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.


Revision tags: yamt-pdpolicy-base4 elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base3
# 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().


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 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.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 ktrace-lwp-base
# 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)


Revision tags: yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base
# 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.


Revision tags: yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 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


Revision tags: kent-audio2-base
# 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.


Revision tags: yamt-km-base4 yamt-km-base3 netbsd-3-base
# 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.


Revision tags: yamt-km-base2
# 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.


Revision tags: yamt-km-base kent-audio1-beforemerge bouyer-xen2-base kent-audio1-base
# 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


Revision tags: netbsd-2-0-base
# 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.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.


Revision tags: bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 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


Revision tags: is-mlppp-base ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
# 1.179 07-Sep-2019 maxv

Merge amd64func.S into cpufunc.S, and clean up.


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.178 14-Feb-2019 cherry

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


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 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.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728
# 1.170 26-Jul-2018 maxv

Merge the content of xen_debug.c into xen_machdep.c, there is only one
function.


Revision tags: phil-wifi-base pgoyette-compat-0625
# 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.


Revision tags: pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322
# 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)


Revision tags: pgoyette-compat-0315 pgoyette-compat-base
# 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


Revision tags: tls-maxphys-base-20171202
# 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


Revision tags: nick-nhusb-base-20170825
# 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.


Revision tags: perseant-stdc-iso10646-base
# 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)


Revision tags: netbsd-8-base
# 1.147 23-May-2017 nonaka

branches: 1.147.2;
x86: hypervisor detection from FreeBSD for x2APIC support.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.146 24-Mar-2017 maxv

Don't compile PMCs on Xen.


Revision tags: pgoyette-localcount-20170320
# 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.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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>


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.141 20-May-2016 jnemeth

branches: 1.141.2;
make CPU microcode loading dependent on both DOM0OPS AND CPU_UCODE


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 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


Revision tags: nick-nhusb-base-20151226
# 1.138 11-Nov-2015 skrll

Fix XEN build - does XEN really want/need pmap_pv_track?


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base
# 1.134 11-Oct-2014 uebayasi

branches: 1.134.2;
Mark machdep files.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 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!


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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@


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase
# 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.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 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.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 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.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3
# 1.99 30-Apr-2009 pgoyette

Include cpu_topology.c for xen kernels, too.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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.


Revision tags: mjf-devfs2-base
# 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.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 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.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 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.


Revision tags: yamt-nfs-mp-base
# 1.84 25-Apr-2008 ad

branches: 1.84.2; 1.84.4;
Include null IPI functions if !MULTIPROCESSOR.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.83 27-Feb-2008 dogcow

branches: 1.83.2;
fix longrun build borkage on i386


Revision tags: nick-net80211-sync-base
# 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.


Revision tags: mjf-devfs-base
# 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.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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.


Revision tags: matt-armv6-base
# 1.76 01-Jan-2008 yamt

try to detect processor resource sharing topologies. ie. package/core/smt IDs.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: bouyer-xenamd64-base
# 1.70 22-Nov-2007 yamt

remove lock_machdep.c


Revision tags: bouyer-xenamd64-base2
# 1.69 15-Nov-2007 ad

Remove support for 80386 level CPUs. PR port-i386/36163.


Revision tags: jmcneill-base
# 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.


Revision tags: yamt-x86pmap-base4
# 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.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 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.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 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.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 1.56 18-Feb-2007 dsl

Get config(1) to supply the default values for BEEP_ONHALT.


Revision tags: post-newlock2-merge
# 1.55 09-Feb-2007 ad

branches: 1.55.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 newlock2-base
# 1.54 18-Dec-2006 gdt

Use agp_machdep.c from the new location (x86, not i386).


Revision tags: yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 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@.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.46 11-Aug-2006 yamt

branches: 1.46.2; 1.46.4;
"xm shutdown" support for xen3. ok'ed by Manuel Bouyer.


Revision tags: abandoned-netbsd-4-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 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.


Revision tags: yamt-pdpolicy-base5
# 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.


Revision tags: yamt-pdpolicy-base4 elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base3
# 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().


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 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.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 ktrace-lwp-base
# 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)


Revision tags: yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base
# 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.


Revision tags: yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 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


Revision tags: kent-audio2-base
# 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.


Revision tags: yamt-km-base4 yamt-km-base3 netbsd-3-base
# 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.


Revision tags: yamt-km-base2
# 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.


Revision tags: yamt-km-base kent-audio1-beforemerge bouyer-xen2-base kent-audio1-base
# 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


Revision tags: netbsd-2-0-base
# 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.180 03-Apr-2020 ad

CPU topology makes almost no sense for Xen, and populates it with B/S values


Revision tags: ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
# 1.179 07-Sep-2019 maxv

Merge amd64func.S into cpufunc.S, and clean up.


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.178 14-Feb-2019 cherry

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


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 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.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728
# 1.170 26-Jul-2018 maxv

Merge the content of xen_debug.c into xen_machdep.c, there is only one
function.


Revision tags: phil-wifi-base pgoyette-compat-0625
# 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.


Revision tags: pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322
# 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)


Revision tags: pgoyette-compat-0315 pgoyette-compat-base
# 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


Revision tags: tls-maxphys-base-20171202
# 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


Revision tags: nick-nhusb-base-20170825
# 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.


Revision tags: perseant-stdc-iso10646-base
# 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)


Revision tags: netbsd-8-base
# 1.147 23-May-2017 nonaka

branches: 1.147.2;
x86: hypervisor detection from FreeBSD for x2APIC support.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.146 24-Mar-2017 maxv

Don't compile PMCs on Xen.


Revision tags: pgoyette-localcount-20170320
# 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.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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>


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.141 20-May-2016 jnemeth

branches: 1.141.2;
make CPU microcode loading dependent on both DOM0OPS AND CPU_UCODE


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 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


Revision tags: nick-nhusb-base-20151226
# 1.138 11-Nov-2015 skrll

Fix XEN build - does XEN really want/need pmap_pv_track?


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base
# 1.134 11-Oct-2014 uebayasi

branches: 1.134.2;
Mark machdep files.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 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!


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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@


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase
# 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.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 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.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 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.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3
# 1.99 30-Apr-2009 pgoyette

Include cpu_topology.c for xen kernels, too.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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.


Revision tags: mjf-devfs2-base
# 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.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 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.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 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.


Revision tags: yamt-nfs-mp-base
# 1.84 25-Apr-2008 ad

branches: 1.84.2; 1.84.4;
Include null IPI functions if !MULTIPROCESSOR.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.83 27-Feb-2008 dogcow

branches: 1.83.2;
fix longrun build borkage on i386


Revision tags: nick-net80211-sync-base
# 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.


Revision tags: mjf-devfs-base
# 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.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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.


Revision tags: matt-armv6-base
# 1.76 01-Jan-2008 yamt

try to detect processor resource sharing topologies. ie. package/core/smt IDs.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: bouyer-xenamd64-base
# 1.70 22-Nov-2007 yamt

remove lock_machdep.c


Revision tags: bouyer-xenamd64-base2
# 1.69 15-Nov-2007 ad

Remove support for 80386 level CPUs. PR port-i386/36163.


Revision tags: jmcneill-base
# 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.


Revision tags: yamt-x86pmap-base4
# 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.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 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.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 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.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 1.56 18-Feb-2007 dsl

Get config(1) to supply the default values for BEEP_ONHALT.


Revision tags: post-newlock2-merge
# 1.55 09-Feb-2007 ad

branches: 1.55.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 newlock2-base
# 1.54 18-Dec-2006 gdt

Use agp_machdep.c from the new location (x86, not i386).


Revision tags: yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 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@.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.46 11-Aug-2006 yamt

branches: 1.46.2; 1.46.4;
"xm shutdown" support for xen3. ok'ed by Manuel Bouyer.


Revision tags: abandoned-netbsd-4-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 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.


Revision tags: yamt-pdpolicy-base5
# 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.


Revision tags: yamt-pdpolicy-base4 elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base3
# 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().


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 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.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 ktrace-lwp-base
# 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)


Revision tags: yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base
# 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.


Revision tags: yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 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


Revision tags: kent-audio2-base
# 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.


Revision tags: yamt-km-base4 yamt-km-base3 netbsd-3-base
# 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.


Revision tags: yamt-km-base2
# 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.


Revision tags: yamt-km-base kent-audio1-beforemerge bouyer-xen2-base kent-audio1-base
# 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


Revision tags: netbsd-2-0-base
# 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.179 07-Sep-2019 maxv

Merge amd64func.S into cpufunc.S, and clean up.


Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.178 14-Feb-2019 cherry

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


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 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.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728
# 1.170 26-Jul-2018 maxv

Merge the content of xen_debug.c into xen_machdep.c, there is only one
function.


Revision tags: phil-wifi-base pgoyette-compat-0625
# 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.


Revision tags: pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322
# 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)


Revision tags: pgoyette-compat-0315 pgoyette-compat-base
# 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


Revision tags: tls-maxphys-base-20171202
# 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


Revision tags: nick-nhusb-base-20170825
# 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.


Revision tags: perseant-stdc-iso10646-base
# 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)


Revision tags: netbsd-8-base
# 1.147 23-May-2017 nonaka

branches: 1.147.2;
x86: hypervisor detection from FreeBSD for x2APIC support.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.146 24-Mar-2017 maxv

Don't compile PMCs on Xen.


Revision tags: pgoyette-localcount-20170320
# 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.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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>


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.141 20-May-2016 jnemeth

branches: 1.141.2;
make CPU microcode loading dependent on both DOM0OPS AND CPU_UCODE


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 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


Revision tags: nick-nhusb-base-20151226
# 1.138 11-Nov-2015 skrll

Fix XEN build - does XEN really want/need pmap_pv_track?


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base
# 1.134 11-Oct-2014 uebayasi

branches: 1.134.2;
Mark machdep files.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 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!


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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@


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase
# 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.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 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.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 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.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3
# 1.99 30-Apr-2009 pgoyette

Include cpu_topology.c for xen kernels, too.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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.


Revision tags: mjf-devfs2-base
# 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.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 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.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 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.


Revision tags: yamt-nfs-mp-base
# 1.84 25-Apr-2008 ad

branches: 1.84.2; 1.84.4;
Include null IPI functions if !MULTIPROCESSOR.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.83 27-Feb-2008 dogcow

branches: 1.83.2;
fix longrun build borkage on i386


Revision tags: nick-net80211-sync-base
# 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.


Revision tags: mjf-devfs-base
# 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.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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.


Revision tags: matt-armv6-base
# 1.76 01-Jan-2008 yamt

try to detect processor resource sharing topologies. ie. package/core/smt IDs.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: bouyer-xenamd64-base
# 1.70 22-Nov-2007 yamt

remove lock_machdep.c


Revision tags: bouyer-xenamd64-base2
# 1.69 15-Nov-2007 ad

Remove support for 80386 level CPUs. PR port-i386/36163.


Revision tags: jmcneill-base
# 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.


Revision tags: yamt-x86pmap-base4
# 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.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 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.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 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.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 1.56 18-Feb-2007 dsl

Get config(1) to supply the default values for BEEP_ONHALT.


Revision tags: post-newlock2-merge
# 1.55 09-Feb-2007 ad

branches: 1.55.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 newlock2-base
# 1.54 18-Dec-2006 gdt

Use agp_machdep.c from the new location (x86, not i386).


Revision tags: yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 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@.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.46 11-Aug-2006 yamt

branches: 1.46.2; 1.46.4;
"xm shutdown" support for xen3. ok'ed by Manuel Bouyer.


Revision tags: abandoned-netbsd-4-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 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.


Revision tags: yamt-pdpolicy-base5
# 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.


Revision tags: yamt-pdpolicy-base4 elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base3
# 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().


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 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.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 ktrace-lwp-base
# 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)


Revision tags: yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base
# 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.


Revision tags: yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 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


Revision tags: kent-audio2-base
# 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.


Revision tags: yamt-km-base4 yamt-km-base3 netbsd-3-base
# 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.


Revision tags: yamt-km-base2
# 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.


Revision tags: yamt-km-base kent-audio1-beforemerge bouyer-xen2-base kent-audio1-base
# 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


Revision tags: netbsd-2-0-base
# 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/)


Revision tags: isaki-audio2-base
# 1.178 14-Feb-2019 cherry

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


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 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.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728
# 1.170 26-Jul-2018 maxv

Merge the content of xen_debug.c into xen_machdep.c, there is only one
function.


Revision tags: phil-wifi-base pgoyette-compat-0625
# 1.169 23-May-2018 maxv

Merge convert_xmm_s87.c into fpu.c. It contains only two functions, that
are used only in fpu.c.


Revision tags: pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322
# 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)


Revision tags: pgoyette-compat-0315 pgoyette-compat-base
# 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


Revision tags: tls-maxphys-base-20171202
# 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


Revision tags: nick-nhusb-base-20170825
# 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.


Revision tags: perseant-stdc-iso10646-base
# 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)


Revision tags: netbsd-8-base
# 1.147 23-May-2017 nonaka

branches: 1.147.2;
x86: hypervisor detection from FreeBSD for x2APIC support.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.146 24-Mar-2017 maxv

Don't compile PMCs on Xen.


Revision tags: pgoyette-localcount-20170320
# 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.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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>


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.141 20-May-2016 jnemeth

branches: 1.141.2;
make CPU microcode loading dependent on both DOM0OPS AND CPU_UCODE


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 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


Revision tags: nick-nhusb-base-20151226
# 1.138 11-Nov-2015 skrll

Fix XEN build - does XEN really want/need pmap_pv_track?


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base
# 1.134 11-Oct-2014 uebayasi

branches: 1.134.2;
Mark machdep files.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 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!


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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@


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase
# 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.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 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.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 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.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3
# 1.99 30-Apr-2009 pgoyette

Include cpu_topology.c for xen kernels, too.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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.


Revision tags: mjf-devfs2-base
# 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.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 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.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 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.


Revision tags: yamt-nfs-mp-base
# 1.84 25-Apr-2008 ad

branches: 1.84.2; 1.84.4;
Include null IPI functions if !MULTIPROCESSOR.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.83 27-Feb-2008 dogcow

branches: 1.83.2;
fix longrun build borkage on i386


Revision tags: nick-net80211-sync-base
# 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.


Revision tags: mjf-devfs-base
# 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.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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.


Revision tags: matt-armv6-base
# 1.76 01-Jan-2008 yamt

try to detect processor resource sharing topologies. ie. package/core/smt IDs.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: bouyer-xenamd64-base
# 1.70 22-Nov-2007 yamt

remove lock_machdep.c


Revision tags: bouyer-xenamd64-base2
# 1.69 15-Nov-2007 ad

Remove support for 80386 level CPUs. PR port-i386/36163.


Revision tags: jmcneill-base
# 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.


Revision tags: yamt-x86pmap-base4
# 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.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 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.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 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.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 1.56 18-Feb-2007 dsl

Get config(1) to supply the default values for BEEP_ONHALT.


Revision tags: post-newlock2-merge
# 1.55 09-Feb-2007 ad

branches: 1.55.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 newlock2-base
# 1.54 18-Dec-2006 gdt

Use agp_machdep.c from the new location (x86, not i386).


Revision tags: yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 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@.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.46 11-Aug-2006 yamt

branches: 1.46.2; 1.46.4;
"xm shutdown" support for xen3. ok'ed by Manuel Bouyer.


Revision tags: abandoned-netbsd-4-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 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.


Revision tags: yamt-pdpolicy-base5
# 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.


Revision tags: yamt-pdpolicy-base4 elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base3
# 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().


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 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.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 ktrace-lwp-base
# 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)


Revision tags: yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base
# 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.


Revision tags: yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 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


Revision tags: kent-audio2-base
# 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.


Revision tags: yamt-km-base4 yamt-km-base3 netbsd-3-base
# 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.


Revision tags: yamt-km-base2
# 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.


Revision tags: yamt-km-base kent-audio1-beforemerge bouyer-xen2-base kent-audio1-base
# 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


Revision tags: netbsd-2-0-base
# 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.165 22-Jan-2018 jdolecek

xen has separate list, update here also for x86/pmap_tlb.c -> x86/x86_tlb.c


Revision tags: tls-maxphys-base-20171202
# 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


Revision tags: nick-nhusb-base-20170825
# 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.


Revision tags: perseant-stdc-iso10646-base
# 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)


Revision tags: netbsd-8-base
# 1.147 23-May-2017 nonaka

branches: 1.147.2;
x86: hypervisor detection from FreeBSD for x2APIC support.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.146 24-Mar-2017 maxv

Don't compile PMCs on Xen.


Revision tags: pgoyette-localcount-20170320
# 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.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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>


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.141 20-May-2016 jnemeth

branches: 1.141.2;
make CPU microcode loading dependent on both DOM0OPS AND CPU_UCODE


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 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


Revision tags: nick-nhusb-base-20151226
# 1.138 11-Nov-2015 skrll

Fix XEN build - does XEN really want/need pmap_pv_track?


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base
# 1.134 11-Oct-2014 uebayasi

branches: 1.134.2;
Mark machdep files.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 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!


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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@


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase
# 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.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 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.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 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.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3
# 1.99 30-Apr-2009 pgoyette

Include cpu_topology.c for xen kernels, too.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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.


Revision tags: mjf-devfs2-base
# 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.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 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.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 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.


Revision tags: yamt-nfs-mp-base
# 1.84 25-Apr-2008 ad

branches: 1.84.2; 1.84.4;
Include null IPI functions if !MULTIPROCESSOR.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.83 27-Feb-2008 dogcow

branches: 1.83.2;
fix longrun build borkage on i386


Revision tags: nick-net80211-sync-base
# 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.


Revision tags: mjf-devfs-base
# 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.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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.


Revision tags: matt-armv6-base
# 1.76 01-Jan-2008 yamt

try to detect processor resource sharing topologies. ie. package/core/smt IDs.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: bouyer-xenamd64-base
# 1.70 22-Nov-2007 yamt

remove lock_machdep.c


Revision tags: bouyer-xenamd64-base2
# 1.69 15-Nov-2007 ad

Remove support for 80386 level CPUs. PR port-i386/36163.


Revision tags: jmcneill-base
# 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.


Revision tags: yamt-x86pmap-base4
# 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.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 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.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 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.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 1.56 18-Feb-2007 dsl

Get config(1) to supply the default values for BEEP_ONHALT.


Revision tags: post-newlock2-merge
# 1.55 09-Feb-2007 ad

branches: 1.55.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 newlock2-base
# 1.54 18-Dec-2006 gdt

Use agp_machdep.c from the new location (x86, not i386).


Revision tags: yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 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@.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.46 11-Aug-2006 yamt

branches: 1.46.2; 1.46.4;
"xm shutdown" support for xen3. ok'ed by Manuel Bouyer.


Revision tags: abandoned-netbsd-4-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 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.


Revision tags: yamt-pdpolicy-base5
# 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.


Revision tags: yamt-pdpolicy-base4 elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base3
# 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().


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 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.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 ktrace-lwp-base
# 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)


Revision tags: yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base
# 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.


Revision tags: yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 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


Revision tags: kent-audio2-base
# 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.


Revision tags: yamt-km-base4 yamt-km-base3 netbsd-3-base
# 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.


Revision tags: yamt-km-base2
# 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.


Revision tags: yamt-km-base kent-audio1-beforemerge bouyer-xen2-base kent-audio1-base
# 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


Revision tags: netbsd-2-0-base
# 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/)


Revision tags: tls-maxphys-base-20171202
# 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


Revision tags: nick-nhusb-base-20170825
# 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.


Revision tags: perseant-stdc-iso10646-base
# 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)


Revision tags: netbsd-8-base
# 1.147 23-May-2017 nonaka

branches: 1.147.2;
x86: hypervisor detection from FreeBSD for x2APIC support.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.146 24-Mar-2017 maxv

Don't compile PMCs on Xen.


Revision tags: pgoyette-localcount-20170320
# 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.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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>


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.141 20-May-2016 jnemeth

branches: 1.141.2;
make CPU microcode loading dependent on both DOM0OPS AND CPU_UCODE


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 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


Revision tags: nick-nhusb-base-20151226
# 1.138 11-Nov-2015 skrll

Fix XEN build - does XEN really want/need pmap_pv_track?


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base
# 1.134 11-Oct-2014 uebayasi

branches: 1.134.2;
Mark machdep files.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 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!


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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@


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase
# 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.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 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.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 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.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3
# 1.99 30-Apr-2009 pgoyette

Include cpu_topology.c for xen kernels, too.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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.


Revision tags: mjf-devfs2-base
# 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.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 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.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 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.


Revision tags: yamt-nfs-mp-base
# 1.84 25-Apr-2008 ad

branches: 1.84.2; 1.84.4;
Include null IPI functions if !MULTIPROCESSOR.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.83 27-Feb-2008 dogcow

branches: 1.83.2;
fix longrun build borkage on i386


Revision tags: nick-net80211-sync-base
# 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.


Revision tags: mjf-devfs-base
# 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.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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.


Revision tags: matt-armv6-base
# 1.76 01-Jan-2008 yamt

try to detect processor resource sharing topologies. ie. package/core/smt IDs.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: bouyer-xenamd64-base
# 1.70 22-Nov-2007 yamt

remove lock_machdep.c


Revision tags: bouyer-xenamd64-base2
# 1.69 15-Nov-2007 ad

Remove support for 80386 level CPUs. PR port-i386/36163.


Revision tags: jmcneill-base
# 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.


Revision tags: yamt-x86pmap-base4
# 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.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 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.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 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.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 1.56 18-Feb-2007 dsl

Get config(1) to supply the default values for BEEP_ONHALT.


Revision tags: post-newlock2-merge
# 1.55 09-Feb-2007 ad

branches: 1.55.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 newlock2-base
# 1.54 18-Dec-2006 gdt

Use agp_machdep.c from the new location (x86, not i386).


Revision tags: yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 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@.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.46 11-Aug-2006 yamt

branches: 1.46.2; 1.46.4;
"xm shutdown" support for xen3. ok'ed by Manuel Bouyer.


Revision tags: abandoned-netbsd-4-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 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.


Revision tags: yamt-pdpolicy-base5
# 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.


Revision tags: yamt-pdpolicy-base4 elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base3
# 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().


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 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.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 ktrace-lwp-base
# 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)


Revision tags: yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base
# 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.


Revision tags: yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 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


Revision tags: kent-audio2-base
# 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.


Revision tags: yamt-km-base4 yamt-km-base3 netbsd-3-base
# 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.


Revision tags: yamt-km-base2
# 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.


Revision tags: yamt-km-base kent-audio1-beforemerge bouyer-xen2-base kent-audio1-base
# 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


Revision tags: netbsd-2-0-base
# 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.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


Revision tags: nick-nhusb-base-20170825
# 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.


Revision tags: perseant-stdc-iso10646-base
# 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)


Revision tags: netbsd-8-base
# 1.147 23-May-2017 nonaka

branches: 1.147.2;
x86: hypervisor detection from FreeBSD for x2APIC support.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.146 24-Mar-2017 maxv

Don't compile PMCs on Xen.


Revision tags: pgoyette-localcount-20170320
# 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.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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>


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.141 20-May-2016 jnemeth

branches: 1.141.2;
make CPU microcode loading dependent on both DOM0OPS AND CPU_UCODE


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 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


Revision tags: nick-nhusb-base-20151226
# 1.138 11-Nov-2015 skrll

Fix XEN build - does XEN really want/need pmap_pv_track?


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base
# 1.134 11-Oct-2014 uebayasi

branches: 1.134.2;
Mark machdep files.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 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!


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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@


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase
# 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.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 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.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 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.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3
# 1.99 30-Apr-2009 pgoyette

Include cpu_topology.c for xen kernels, too.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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.


Revision tags: mjf-devfs2-base
# 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.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 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.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 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.


Revision tags: yamt-nfs-mp-base
# 1.84 25-Apr-2008 ad

branches: 1.84.2; 1.84.4;
Include null IPI functions if !MULTIPROCESSOR.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.83 27-Feb-2008 dogcow

branches: 1.83.2;
fix longrun build borkage on i386


Revision tags: nick-net80211-sync-base
# 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.


Revision tags: mjf-devfs-base
# 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.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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.


Revision tags: matt-armv6-base
# 1.76 01-Jan-2008 yamt

try to detect processor resource sharing topologies. ie. package/core/smt IDs.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: bouyer-xenamd64-base
# 1.70 22-Nov-2007 yamt

remove lock_machdep.c


Revision tags: bouyer-xenamd64-base2
# 1.69 15-Nov-2007 ad

Remove support for 80386 level CPUs. PR port-i386/36163.


Revision tags: jmcneill-base
# 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.


Revision tags: yamt-x86pmap-base4
# 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.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 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.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 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.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 1.56 18-Feb-2007 dsl

Get config(1) to supply the default values for BEEP_ONHALT.


Revision tags: post-newlock2-merge
# 1.55 09-Feb-2007 ad

branches: 1.55.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 newlock2-base
# 1.54 18-Dec-2006 gdt

Use agp_machdep.c from the new location (x86, not i386).


Revision tags: yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 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@.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.46 11-Aug-2006 yamt

branches: 1.46.2; 1.46.4;
"xm shutdown" support for xen3. ok'ed by Manuel Bouyer.


Revision tags: abandoned-netbsd-4-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 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.


Revision tags: yamt-pdpolicy-base5
# 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.


Revision tags: yamt-pdpolicy-base4 elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base3
# 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().


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 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.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 ktrace-lwp-base
# 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)


Revision tags: yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base
# 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.


Revision tags: yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 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


Revision tags: kent-audio2-base
# 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.


Revision tags: yamt-km-base4 yamt-km-base3 netbsd-3-base
# 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.


Revision tags: yamt-km-base2
# 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.


Revision tags: yamt-km-base kent-audio1-beforemerge bouyer-xen2-base kent-audio1-base
# 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


Revision tags: netbsd-2-0-base
# 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.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.


Revision tags: perseant-stdc-iso10646-base
# 1.149 16-Jul-2017 cherry

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)


Revision tags: netbsd-8-base
# 1.147 23-May-2017 nonaka

branches: 1.147.2;
x86: hypervisor detection from FreeBSD for x2APIC support.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.146 24-Mar-2017 maxv

Don't compile PMCs on Xen.


Revision tags: pgoyette-localcount-20170320
# 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.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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>


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.141 20-May-2016 jnemeth

branches: 1.141.2;
make CPU microcode loading dependent on both DOM0OPS AND CPU_UCODE


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 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


Revision tags: nick-nhusb-base-20151226
# 1.138 11-Nov-2015 skrll

Fix XEN build - does XEN really want/need pmap_pv_track?


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base
# 1.134 11-Oct-2014 uebayasi

branches: 1.134.2;
Mark machdep files.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 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!


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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@


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase
# 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.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 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.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 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.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3
# 1.99 30-Apr-2009 pgoyette

Include cpu_topology.c for xen kernels, too.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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.


Revision tags: mjf-devfs2-base
# 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.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 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.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 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.


Revision tags: yamt-nfs-mp-base
# 1.84 25-Apr-2008 ad

branches: 1.84.2; 1.84.4;
Include null IPI functions if !MULTIPROCESSOR.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.83 27-Feb-2008 dogcow

branches: 1.83.2;
fix longrun build borkage on i386


Revision tags: nick-net80211-sync-base
# 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.


Revision tags: mjf-devfs-base
# 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.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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.


Revision tags: matt-armv6-base
# 1.76 01-Jan-2008 yamt

try to detect processor resource sharing topologies. ie. package/core/smt IDs.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: bouyer-xenamd64-base
# 1.70 22-Nov-2007 yamt

remove lock_machdep.c


Revision tags: bouyer-xenamd64-base2
# 1.69 15-Nov-2007 ad

Remove support for 80386 level CPUs. PR port-i386/36163.


Revision tags: jmcneill-base
# 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.


Revision tags: yamt-x86pmap-base4
# 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.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 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.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 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.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 1.56 18-Feb-2007 dsl

Get config(1) to supply the default values for BEEP_ONHALT.


Revision tags: post-newlock2-merge
# 1.55 09-Feb-2007 ad

branches: 1.55.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 newlock2-base
# 1.54 18-Dec-2006 gdt

Use agp_machdep.c from the new location (x86, not i386).


Revision tags: yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 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@.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.46 11-Aug-2006 yamt

branches: 1.46.2; 1.46.4;
"xm shutdown" support for xen3. ok'ed by Manuel Bouyer.


Revision tags: abandoned-netbsd-4-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 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.


Revision tags: yamt-pdpolicy-base5
# 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.


Revision tags: yamt-pdpolicy-base4 elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base3
# 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().


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 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.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 ktrace-lwp-base
# 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)


Revision tags: yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base
# 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.


Revision tags: yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 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


Revision tags: kent-audio2-base
# 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.


Revision tags: yamt-km-base4 yamt-km-base3 netbsd-3-base
# 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.


Revision tags: yamt-km-base2
# 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.


Revision tags: yamt-km-base kent-audio1-beforemerge bouyer-xen2-base kent-audio1-base
# 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


Revision tags: netbsd-2-0-base
# 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.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.


Revision tags: perseant-stdc-iso10646-base
# 1.149 16-Jul-2017 cherry

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)


Revision tags: netbsd-8-base
# 1.147 23-May-2017 nonaka

branches: 1.147.2;
x86: hypervisor detection from FreeBSD for x2APIC support.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.146 24-Mar-2017 maxv

Don't compile PMCs on Xen.


Revision tags: pgoyette-localcount-20170320
# 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.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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>


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.141 20-May-2016 jnemeth

branches: 1.141.2;
make CPU microcode loading dependent on both DOM0OPS AND CPU_UCODE


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 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


Revision tags: nick-nhusb-base-20151226
# 1.138 11-Nov-2015 skrll

Fix XEN build - does XEN really want/need pmap_pv_track?


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base
# 1.134 11-Oct-2014 uebayasi

branches: 1.134.2;
Mark machdep files.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 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!


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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@


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase
# 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.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 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.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 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.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3
# 1.99 30-Apr-2009 pgoyette

Include cpu_topology.c for xen kernels, too.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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.


Revision tags: mjf-devfs2-base
# 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.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 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.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 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.


Revision tags: yamt-nfs-mp-base
# 1.84 25-Apr-2008 ad

branches: 1.84.2; 1.84.4;
Include null IPI functions if !MULTIPROCESSOR.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.83 27-Feb-2008 dogcow

branches: 1.83.2;
fix longrun build borkage on i386


Revision tags: nick-net80211-sync-base
# 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.


Revision tags: mjf-devfs-base
# 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.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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.


Revision tags: matt-armv6-base
# 1.76 01-Jan-2008 yamt

try to detect processor resource sharing topologies. ie. package/core/smt IDs.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: bouyer-xenamd64-base
# 1.70 22-Nov-2007 yamt

remove lock_machdep.c


Revision tags: bouyer-xenamd64-base2
# 1.69 15-Nov-2007 ad

Remove support for 80386 level CPUs. PR port-i386/36163.


Revision tags: jmcneill-base
# 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.


Revision tags: yamt-x86pmap-base4
# 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.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 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.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 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.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 1.56 18-Feb-2007 dsl

Get config(1) to supply the default values for BEEP_ONHALT.


Revision tags: post-newlock2-merge
# 1.55 09-Feb-2007 ad

branches: 1.55.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 newlock2-base
# 1.54 18-Dec-2006 gdt

Use agp_machdep.c from the new location (x86, not i386).


Revision tags: yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 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@.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.46 11-Aug-2006 yamt

branches: 1.46.2; 1.46.4;
"xm shutdown" support for xen3. ok'ed by Manuel Bouyer.


Revision tags: abandoned-netbsd-4-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 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.


Revision tags: yamt-pdpolicy-base5
# 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.


Revision tags: yamt-pdpolicy-base4 elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base3
# 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().


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 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.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 ktrace-lwp-base
# 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)


Revision tags: yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base
# 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.


Revision tags: yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 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


Revision tags: kent-audio2-base
# 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.


Revision tags: yamt-km-base4 yamt-km-base3 netbsd-3-base
# 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.


Revision tags: yamt-km-base2
# 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.


Revision tags: yamt-km-base kent-audio1-beforemerge bouyer-xen2-base kent-audio1-base
# 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


Revision tags: netbsd-2-0-base
# 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.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.


Revision tags: perseant-stdc-iso10646-base
# 1.149 16-Jul-2017 cherry

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)


Revision tags: netbsd-8-base
# 1.147 23-May-2017 nonaka

branches: 1.147.2;
x86: hypervisor detection from FreeBSD for x2APIC support.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.146 24-Mar-2017 maxv

Don't compile PMCs on Xen.


Revision tags: pgoyette-localcount-20170320
# 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.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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>


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.141 20-May-2016 jnemeth

branches: 1.141.2;
make CPU microcode loading dependent on both DOM0OPS AND CPU_UCODE


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 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


Revision tags: nick-nhusb-base-20151226
# 1.138 11-Nov-2015 skrll

Fix XEN build - does XEN really want/need pmap_pv_track?


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base
# 1.134 11-Oct-2014 uebayasi

branches: 1.134.2;
Mark machdep files.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 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!


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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@


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase
# 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.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 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.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 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.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3
# 1.99 30-Apr-2009 pgoyette

Include cpu_topology.c for xen kernels, too.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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.


Revision tags: mjf-devfs2-base
# 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.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 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.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 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.


Revision tags: yamt-nfs-mp-base
# 1.84 25-Apr-2008 ad

branches: 1.84.2; 1.84.4;
Include null IPI functions if !MULTIPROCESSOR.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.83 27-Feb-2008 dogcow

branches: 1.83.2;
fix longrun build borkage on i386


Revision tags: nick-net80211-sync-base
# 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.


Revision tags: mjf-devfs-base
# 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.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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.


Revision tags: matt-armv6-base
# 1.76 01-Jan-2008 yamt

try to detect processor resource sharing topologies. ie. package/core/smt IDs.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: bouyer-xenamd64-base
# 1.70 22-Nov-2007 yamt

remove lock_machdep.c


Revision tags: bouyer-xenamd64-base2
# 1.69 15-Nov-2007 ad

Remove support for 80386 level CPUs. PR port-i386/36163.


Revision tags: jmcneill-base
# 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.


Revision tags: yamt-x86pmap-base4
# 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.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 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.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 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.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 1.56 18-Feb-2007 dsl

Get config(1) to supply the default values for BEEP_ONHALT.


Revision tags: post-newlock2-merge
# 1.55 09-Feb-2007 ad

branches: 1.55.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 newlock2-base
# 1.54 18-Dec-2006 gdt

Use agp_machdep.c from the new location (x86, not i386).


Revision tags: yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 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@.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.46 11-Aug-2006 yamt

branches: 1.46.2; 1.46.4;
"xm shutdown" support for xen3. ok'ed by Manuel Bouyer.


Revision tags: abandoned-netbsd-4-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 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.


Revision tags: yamt-pdpolicy-base5
# 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.


Revision tags: yamt-pdpolicy-base4 elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base3
# 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().


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 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.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 ktrace-lwp-base
# 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)


Revision tags: yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base
# 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.


Revision tags: yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 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


Revision tags: kent-audio2-base
# 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.


Revision tags: yamt-km-base4 yamt-km-base3 netbsd-3-base
# 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.


Revision tags: yamt-km-base2
# 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.


Revision tags: yamt-km-base kent-audio1-beforemerge bouyer-xen2-base kent-audio1-base
# 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


Revision tags: netbsd-2-0-base
# 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.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.


Revision tags: perseant-stdc-iso10646-base
# 1.149 16-Jul-2017 cherry

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)


Revision tags: netbsd-8-base
# 1.147 23-May-2017 nonaka

branches: 1.147.2;
x86: hypervisor detection from FreeBSD for x2APIC support.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.146 24-Mar-2017 maxv

Don't compile PMCs on Xen.


Revision tags: pgoyette-localcount-20170320
# 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.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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>


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.141 20-May-2016 jnemeth

branches: 1.141.2;
make CPU microcode loading dependent on both DOM0OPS AND CPU_UCODE


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 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


Revision tags: nick-nhusb-base-20151226
# 1.138 11-Nov-2015 skrll

Fix XEN build - does XEN really want/need pmap_pv_track?


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base
# 1.134 11-Oct-2014 uebayasi

branches: 1.134.2;
Mark machdep files.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 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!


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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@


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase
# 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.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 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.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 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.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3
# 1.99 30-Apr-2009 pgoyette

Include cpu_topology.c for xen kernels, too.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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.


Revision tags: mjf-devfs2-base
# 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.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 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.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 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.


Revision tags: yamt-nfs-mp-base
# 1.84 25-Apr-2008 ad

branches: 1.84.2; 1.84.4;
Include null IPI functions if !MULTIPROCESSOR.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.83 27-Feb-2008 dogcow

branches: 1.83.2;
fix longrun build borkage on i386


Revision tags: nick-net80211-sync-base
# 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.


Revision tags: mjf-devfs-base
# 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.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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.


Revision tags: matt-armv6-base
# 1.76 01-Jan-2008 yamt

try to detect processor resource sharing topologies. ie. package/core/smt IDs.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: bouyer-xenamd64-base
# 1.70 22-Nov-2007 yamt

remove lock_machdep.c


Revision tags: bouyer-xenamd64-base2
# 1.69 15-Nov-2007 ad

Remove support for 80386 level CPUs. PR port-i386/36163.


Revision tags: jmcneill-base
# 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.


Revision tags: yamt-x86pmap-base4
# 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.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 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.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 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.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 1.56 18-Feb-2007 dsl

Get config(1) to supply the default values for BEEP_ONHALT.


Revision tags: post-newlock2-merge
# 1.55 09-Feb-2007 ad

branches: 1.55.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 newlock2-base
# 1.54 18-Dec-2006 gdt

Use agp_machdep.c from the new location (x86, not i386).


Revision tags: yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 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@.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.46 11-Aug-2006 yamt

branches: 1.46.2; 1.46.4;
"xm shutdown" support for xen3. ok'ed by Manuel Bouyer.


Revision tags: abandoned-netbsd-4-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 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.


Revision tags: yamt-pdpolicy-base5
# 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.


Revision tags: yamt-pdpolicy-base4 elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base3
# 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().


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 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.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 ktrace-lwp-base
# 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)


Revision tags: yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base
# 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.


Revision tags: yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 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


Revision tags: kent-audio2-base
# 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.


Revision tags: yamt-km-base4 yamt-km-base3 netbsd-3-base
# 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.


Revision tags: yamt-km-base2
# 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.


Revision tags: yamt-km-base kent-audio1-beforemerge bouyer-xen2-base kent-audio1-base
# 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


Revision tags: netbsd-2-0-base
# 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.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.


Revision tags: perseant-stdc-iso10646-base
# 1.149 16-Jul-2017 cherry

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)


Revision tags: netbsd-8-base
# 1.147 23-May-2017 nonaka

branches: 1.147.2;
x86: hypervisor detection from FreeBSD for x2APIC support.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.146 24-Mar-2017 maxv

Don't compile PMCs on Xen.


Revision tags: pgoyette-localcount-20170320
# 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.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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>


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.141 20-May-2016 jnemeth

branches: 1.141.2;
make CPU microcode loading dependent on both DOM0OPS AND CPU_UCODE


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 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


Revision tags: nick-nhusb-base-20151226
# 1.138 11-Nov-2015 skrll

Fix XEN build - does XEN really want/need pmap_pv_track?


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base
# 1.134 11-Oct-2014 uebayasi

branches: 1.134.2;
Mark machdep files.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 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!


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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@


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase
# 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.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 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.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 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.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3
# 1.99 30-Apr-2009 pgoyette

Include cpu_topology.c for xen kernels, too.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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.


Revision tags: mjf-devfs2-base
# 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.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 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.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 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.


Revision tags: yamt-nfs-mp-base
# 1.84 25-Apr-2008 ad

branches: 1.84.2; 1.84.4;
Include null IPI functions if !MULTIPROCESSOR.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.83 27-Feb-2008 dogcow

branches: 1.83.2;
fix longrun build borkage on i386


Revision tags: nick-net80211-sync-base
# 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.


Revision tags: mjf-devfs-base
# 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.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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.


Revision tags: matt-armv6-base
# 1.76 01-Jan-2008 yamt

try to detect processor resource sharing topologies. ie. package/core/smt IDs.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: bouyer-xenamd64-base
# 1.70 22-Nov-2007 yamt

remove lock_machdep.c


Revision tags: bouyer-xenamd64-base2
# 1.69 15-Nov-2007 ad

Remove support for 80386 level CPUs. PR port-i386/36163.


Revision tags: jmcneill-base
# 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.


Revision tags: yamt-x86pmap-base4
# 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.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 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.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 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.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 1.56 18-Feb-2007 dsl

Get config(1) to supply the default values for BEEP_ONHALT.


Revision tags: post-newlock2-merge
# 1.55 09-Feb-2007 ad

branches: 1.55.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 newlock2-base
# 1.54 18-Dec-2006 gdt

Use agp_machdep.c from the new location (x86, not i386).


Revision tags: yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 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@.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.46 11-Aug-2006 yamt

branches: 1.46.2; 1.46.4;
"xm shutdown" support for xen3. ok'ed by Manuel Bouyer.


Revision tags: abandoned-netbsd-4-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 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.


Revision tags: yamt-pdpolicy-base5
# 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.


Revision tags: yamt-pdpolicy-base4 elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base3
# 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().


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 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.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 ktrace-lwp-base
# 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)


Revision tags: yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base
# 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.


Revision tags: yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 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


Revision tags: kent-audio2-base
# 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.


Revision tags: yamt-km-base4 yamt-km-base3 netbsd-3-base
# 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.


Revision tags: yamt-km-base2
# 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.


Revision tags: yamt-km-base kent-audio1-beforemerge bouyer-xen2-base kent-audio1-base
# 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


Revision tags: netbsd-2-0-base
# 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.149 16-Jul-2017 cherry

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)


Revision tags: netbsd-8-base
# 1.147 23-May-2017 nonaka

branches: 1.147.2;
x86: hypervisor detection from FreeBSD for x2APIC support.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.146 24-Mar-2017 maxv

Don't compile PMCs on Xen.


Revision tags: pgoyette-localcount-20170320
# 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.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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>


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.141 20-May-2016 jnemeth

branches: 1.141.2;
make CPU microcode loading dependent on both DOM0OPS AND CPU_UCODE


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 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


Revision tags: nick-nhusb-base-20151226
# 1.138 11-Nov-2015 skrll

Fix XEN build - does XEN really want/need pmap_pv_track?


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base
# 1.134 11-Oct-2014 uebayasi

branches: 1.134.2;
Mark machdep files.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 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!


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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@


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase
# 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.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 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.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 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.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3
# 1.99 30-Apr-2009 pgoyette

Include cpu_topology.c for xen kernels, too.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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.


Revision tags: mjf-devfs2-base
# 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.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 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.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 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.


Revision tags: yamt-nfs-mp-base
# 1.84 25-Apr-2008 ad

branches: 1.84.2; 1.84.4;
Include null IPI functions if !MULTIPROCESSOR.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.83 27-Feb-2008 dogcow

branches: 1.83.2;
fix longrun build borkage on i386


Revision tags: nick-net80211-sync-base
# 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.


Revision tags: mjf-devfs-base
# 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.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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.


Revision tags: matt-armv6-base
# 1.76 01-Jan-2008 yamt

try to detect processor resource sharing topologies. ie. package/core/smt IDs.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: bouyer-xenamd64-base
# 1.70 22-Nov-2007 yamt

remove lock_machdep.c


Revision tags: bouyer-xenamd64-base2
# 1.69 15-Nov-2007 ad

Remove support for 80386 level CPUs. PR port-i386/36163.


Revision tags: jmcneill-base
# 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.


Revision tags: yamt-x86pmap-base4
# 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.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 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.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 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.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 1.56 18-Feb-2007 dsl

Get config(1) to supply the default values for BEEP_ONHALT.


Revision tags: post-newlock2-merge
# 1.55 09-Feb-2007 ad

branches: 1.55.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 newlock2-base
# 1.54 18-Dec-2006 gdt

Use agp_machdep.c from the new location (x86, not i386).


Revision tags: yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 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@.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.46 11-Aug-2006 yamt

branches: 1.46.2; 1.46.4;
"xm shutdown" support for xen3. ok'ed by Manuel Bouyer.


Revision tags: abandoned-netbsd-4-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 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.


Revision tags: yamt-pdpolicy-base5
# 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.


Revision tags: yamt-pdpolicy-base4 elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base3
# 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().


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 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.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 ktrace-lwp-base
# 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)


Revision tags: yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base
# 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.


Revision tags: yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 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


Revision tags: kent-audio2-base
# 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.


Revision tags: yamt-km-base4 yamt-km-base3 netbsd-3-base
# 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.


Revision tags: yamt-km-base2
# 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.


Revision tags: yamt-km-base kent-audio1-beforemerge bouyer-xen2-base kent-audio1-base
# 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


Revision tags: netbsd-2-0-base
# 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.148 22-Jun-2017 khorben

Register support for SD card readers with Xen DOM0 kernels

Tested on a Lenovo ThinkPad T440s (amd64)


Revision tags: netbsd-8-base
# 1.147 23-May-2017 nonaka

x86: hypervisor detection from FreeBSD for x2APIC support.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.146 24-Mar-2017 maxv

Don't compile PMCs on Xen.


Revision tags: pgoyette-localcount-20170320
# 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.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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>


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.141 20-May-2016 jnemeth

branches: 1.141.2;
make CPU microcode loading dependent on both DOM0OPS AND CPU_UCODE


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 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


Revision tags: nick-nhusb-base-20151226
# 1.138 11-Nov-2015 skrll

Fix XEN build - does XEN really want/need pmap_pv_track?


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base
# 1.134 11-Oct-2014 uebayasi

branches: 1.134.2;
Mark machdep files.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 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!


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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@


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase
# 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.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 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.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 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.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3
# 1.99 30-Apr-2009 pgoyette

Include cpu_topology.c for xen kernels, too.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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.


Revision tags: mjf-devfs2-base
# 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.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 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.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 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.


Revision tags: yamt-nfs-mp-base
# 1.84 25-Apr-2008 ad

branches: 1.84.2; 1.84.4;
Include null IPI functions if !MULTIPROCESSOR.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.83 27-Feb-2008 dogcow

branches: 1.83.2;
fix longrun build borkage on i386


Revision tags: nick-net80211-sync-base
# 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.


Revision tags: mjf-devfs-base
# 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.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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.


Revision tags: matt-armv6-base
# 1.76 01-Jan-2008 yamt

try to detect processor resource sharing topologies. ie. package/core/smt IDs.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: bouyer-xenamd64-base
# 1.70 22-Nov-2007 yamt

remove lock_machdep.c


Revision tags: bouyer-xenamd64-base2
# 1.69 15-Nov-2007 ad

Remove support for 80386 level CPUs. PR port-i386/36163.


Revision tags: jmcneill-base
# 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.


Revision tags: yamt-x86pmap-base4
# 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.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 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.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 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.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 1.56 18-Feb-2007 dsl

Get config(1) to supply the default values for BEEP_ONHALT.


Revision tags: post-newlock2-merge
# 1.55 09-Feb-2007 ad

branches: 1.55.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 newlock2-base
# 1.54 18-Dec-2006 gdt

Use agp_machdep.c from the new location (x86, not i386).


Revision tags: yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 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@.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.46 11-Aug-2006 yamt

branches: 1.46.2; 1.46.4;
"xm shutdown" support for xen3. ok'ed by Manuel Bouyer.


Revision tags: abandoned-netbsd-4-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 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.


Revision tags: yamt-pdpolicy-base5
# 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.


Revision tags: yamt-pdpolicy-base4 elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base3
# 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().


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 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.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 ktrace-lwp-base
# 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)


Revision tags: yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base
# 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.


Revision tags: yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 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


Revision tags: kent-audio2-base
# 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.


Revision tags: yamt-km-base4 yamt-km-base3 netbsd-3-base
# 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.


Revision tags: yamt-km-base2
# 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.


Revision tags: yamt-km-base kent-audio1-beforemerge bouyer-xen2-base kent-audio1-base
# 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


Revision tags: netbsd-2-0-base
# 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.147 23-May-2017 nonaka

x86: hypervisor detection from FreeBSD for x2APIC support.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.146 24-Mar-2017 maxv

Don't compile PMCs on Xen.


Revision tags: pgoyette-localcount-20170320
# 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.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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>


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.141 20-May-2016 jnemeth

branches: 1.141.2;
make CPU microcode loading dependent on both DOM0OPS AND CPU_UCODE


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 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


Revision tags: nick-nhusb-base-20151226
# 1.138 11-Nov-2015 skrll

Fix XEN build - does XEN really want/need pmap_pv_track?


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base
# 1.134 11-Oct-2014 uebayasi

branches: 1.134.2;
Mark machdep files.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 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!


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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@


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase
# 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.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 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.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 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.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3
# 1.99 30-Apr-2009 pgoyette

Include cpu_topology.c for xen kernels, too.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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.


Revision tags: mjf-devfs2-base
# 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.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 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.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 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.


Revision tags: yamt-nfs-mp-base
# 1.84 25-Apr-2008 ad

branches: 1.84.2; 1.84.4;
Include null IPI functions if !MULTIPROCESSOR.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.83 27-Feb-2008 dogcow

branches: 1.83.2;
fix longrun build borkage on i386


Revision tags: nick-net80211-sync-base
# 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.


Revision tags: mjf-devfs-base
# 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.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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.


Revision tags: matt-armv6-base
# 1.76 01-Jan-2008 yamt

try to detect processor resource sharing topologies. ie. package/core/smt IDs.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: bouyer-xenamd64-base
# 1.70 22-Nov-2007 yamt

remove lock_machdep.c


Revision tags: bouyer-xenamd64-base2
# 1.69 15-Nov-2007 ad

Remove support for 80386 level CPUs. PR port-i386/36163.


Revision tags: jmcneill-base
# 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.


Revision tags: yamt-x86pmap-base4
# 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.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 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.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 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.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 1.56 18-Feb-2007 dsl

Get config(1) to supply the default values for BEEP_ONHALT.


Revision tags: post-newlock2-merge
# 1.55 09-Feb-2007 ad

branches: 1.55.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 newlock2-base
# 1.54 18-Dec-2006 gdt

Use agp_machdep.c from the new location (x86, not i386).


Revision tags: yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 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@.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.46 11-Aug-2006 yamt

branches: 1.46.2; 1.46.4;
"xm shutdown" support for xen3. ok'ed by Manuel Bouyer.


Revision tags: abandoned-netbsd-4-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 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.


Revision tags: yamt-pdpolicy-base5
# 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.


Revision tags: yamt-pdpolicy-base4 elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base3
# 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().


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 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.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 ktrace-lwp-base
# 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)


Revision tags: yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base
# 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.


Revision tags: yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 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


Revision tags: kent-audio2-base
# 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.


Revision tags: yamt-km-base4 yamt-km-base3 netbsd-3-base
# 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.


Revision tags: yamt-km-base2
# 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.


Revision tags: yamt-km-base kent-audio1-beforemerge bouyer-xen2-base kent-audio1-base
# 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


Revision tags: netbsd-2-0-base
# 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/)


Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.146 24-Mar-2017 maxv

Don't compile PMCs on Xen.


Revision tags: pgoyette-localcount-20170320
# 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.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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>


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.141 20-May-2016 jnemeth

branches: 1.141.2;
make CPU microcode loading dependent on both DOM0OPS AND CPU_UCODE


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 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


Revision tags: nick-nhusb-base-20151226
# 1.138 11-Nov-2015 skrll

Fix XEN build - does XEN really want/need pmap_pv_track?


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base
# 1.134 11-Oct-2014 uebayasi

branches: 1.134.2;
Mark machdep files.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 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!


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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@


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase
# 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.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 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.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 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.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3
# 1.99 30-Apr-2009 pgoyette

Include cpu_topology.c for xen kernels, too.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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.


Revision tags: mjf-devfs2-base
# 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.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 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.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 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.


Revision tags: yamt-nfs-mp-base
# 1.84 25-Apr-2008 ad

branches: 1.84.2; 1.84.4;
Include null IPI functions if !MULTIPROCESSOR.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.83 27-Feb-2008 dogcow

branches: 1.83.2;
fix longrun build borkage on i386


Revision tags: nick-net80211-sync-base
# 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.


Revision tags: mjf-devfs-base
# 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.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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.


Revision tags: matt-armv6-base
# 1.76 01-Jan-2008 yamt

try to detect processor resource sharing topologies. ie. package/core/smt IDs.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: bouyer-xenamd64-base
# 1.70 22-Nov-2007 yamt

remove lock_machdep.c


Revision tags: bouyer-xenamd64-base2
# 1.69 15-Nov-2007 ad

Remove support for 80386 level CPUs. PR port-i386/36163.


Revision tags: jmcneill-base
# 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.


Revision tags: yamt-x86pmap-base4
# 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.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 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.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 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.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 1.56 18-Feb-2007 dsl

Get config(1) to supply the default values for BEEP_ONHALT.


Revision tags: post-newlock2-merge
# 1.55 09-Feb-2007 ad

branches: 1.55.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 newlock2-base
# 1.54 18-Dec-2006 gdt

Use agp_machdep.c from the new location (x86, not i386).


Revision tags: yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 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@.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.46 11-Aug-2006 yamt

branches: 1.46.2; 1.46.4;
"xm shutdown" support for xen3. ok'ed by Manuel Bouyer.


Revision tags: abandoned-netbsd-4-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 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.


Revision tags: yamt-pdpolicy-base5
# 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.


Revision tags: yamt-pdpolicy-base4 elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base3
# 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().


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 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.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 ktrace-lwp-base
# 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)


Revision tags: yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base
# 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.


Revision tags: yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 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


Revision tags: kent-audio2-base
# 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.


Revision tags: yamt-km-base4 yamt-km-base3 netbsd-3-base
# 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.


Revision tags: yamt-km-base2
# 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.


Revision tags: yamt-km-base kent-audio1-beforemerge bouyer-xen2-base kent-audio1-base
# 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


Revision tags: netbsd-2-0-base
# 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.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.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 1.143 15-Dec-2016 kamil

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>


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.141 20-May-2016 jnemeth

branches: 1.141.2;
make CPU microcode loading dependent on both DOM0OPS AND CPU_UCODE


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 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


Revision tags: nick-nhusb-base-20151226
# 1.138 11-Nov-2015 skrll

Fix XEN build - does XEN really want/need pmap_pv_track?


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base
# 1.134 11-Oct-2014 uebayasi

branches: 1.134.2;
Mark machdep files.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 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!


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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@


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase
# 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.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 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.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 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.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3
# 1.99 30-Apr-2009 pgoyette

Include cpu_topology.c for xen kernels, too.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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.


Revision tags: mjf-devfs2-base
# 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.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 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.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 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.


Revision tags: yamt-nfs-mp-base
# 1.84 25-Apr-2008 ad

branches: 1.84.2; 1.84.4;
Include null IPI functions if !MULTIPROCESSOR.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.83 27-Feb-2008 dogcow

branches: 1.83.2;
fix longrun build borkage on i386


Revision tags: nick-net80211-sync-base
# 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.


Revision tags: mjf-devfs-base
# 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.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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.


Revision tags: matt-armv6-base
# 1.76 01-Jan-2008 yamt

try to detect processor resource sharing topologies. ie. package/core/smt IDs.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: bouyer-xenamd64-base
# 1.70 22-Nov-2007 yamt

remove lock_machdep.c


Revision tags: bouyer-xenamd64-base2
# 1.69 15-Nov-2007 ad

Remove support for 80386 level CPUs. PR port-i386/36163.


Revision tags: jmcneill-base
# 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.


Revision tags: yamt-x86pmap-base4
# 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.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 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.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 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.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 1.56 18-Feb-2007 dsl

Get config(1) to supply the default values for BEEP_ONHALT.


Revision tags: post-newlock2-merge
# 1.55 09-Feb-2007 ad

branches: 1.55.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 newlock2-base
# 1.54 18-Dec-2006 gdt

Use agp_machdep.c from the new location (x86, not i386).


Revision tags: yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 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@.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.46 11-Aug-2006 yamt

branches: 1.46.2; 1.46.4;
"xm shutdown" support for xen3. ok'ed by Manuel Bouyer.


Revision tags: abandoned-netbsd-4-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 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.


Revision tags: yamt-pdpolicy-base5
# 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.


Revision tags: yamt-pdpolicy-base4 elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base3
# 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().


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 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.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 ktrace-lwp-base
# 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)


Revision tags: yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base
# 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.


Revision tags: yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 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


Revision tags: kent-audio2-base
# 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.


Revision tags: yamt-km-base4 yamt-km-base3 netbsd-3-base
# 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.


Revision tags: yamt-km-base2
# 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.


Revision tags: yamt-km-base kent-audio1-beforemerge bouyer-xen2-base kent-audio1-base
# 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


Revision tags: netbsd-2-0-base
# 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.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.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 1.143 15-Dec-2016 kamil

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>


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.141 20-May-2016 jnemeth

branches: 1.141.2;
make CPU microcode loading dependent on both DOM0OPS AND CPU_UCODE


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 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


Revision tags: nick-nhusb-base-20151226
# 1.138 11-Nov-2015 skrll

Fix XEN build - does XEN really want/need pmap_pv_track?


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base
# 1.134 11-Oct-2014 uebayasi

branches: 1.134.2;
Mark machdep files.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 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!


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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@


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase
# 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.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 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.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 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.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3
# 1.99 30-Apr-2009 pgoyette

Include cpu_topology.c for xen kernels, too.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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.


Revision tags: mjf-devfs2-base
# 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.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 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.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 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.


Revision tags: yamt-nfs-mp-base
# 1.84 25-Apr-2008 ad

branches: 1.84.2; 1.84.4;
Include null IPI functions if !MULTIPROCESSOR.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.83 27-Feb-2008 dogcow

branches: 1.83.2;
fix longrun build borkage on i386


Revision tags: nick-net80211-sync-base
# 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.


Revision tags: mjf-devfs-base
# 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.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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.


Revision tags: matt-armv6-base
# 1.76 01-Jan-2008 yamt

try to detect processor resource sharing topologies. ie. package/core/smt IDs.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: bouyer-xenamd64-base
# 1.70 22-Nov-2007 yamt

remove lock_machdep.c


Revision tags: bouyer-xenamd64-base2
# 1.69 15-Nov-2007 ad

Remove support for 80386 level CPUs. PR port-i386/36163.


Revision tags: jmcneill-base
# 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.


Revision tags: yamt-x86pmap-base4
# 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.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 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.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 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.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 1.56 18-Feb-2007 dsl

Get config(1) to supply the default values for BEEP_ONHALT.


Revision tags: post-newlock2-merge
# 1.55 09-Feb-2007 ad

branches: 1.55.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 newlock2-base
# 1.54 18-Dec-2006 gdt

Use agp_machdep.c from the new location (x86, not i386).


Revision tags: yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 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@.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.46 11-Aug-2006 yamt

branches: 1.46.2; 1.46.4;
"xm shutdown" support for xen3. ok'ed by Manuel Bouyer.


Revision tags: abandoned-netbsd-4-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 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.


Revision tags: yamt-pdpolicy-base5
# 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.


Revision tags: yamt-pdpolicy-base4 elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base3
# 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().


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 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.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 ktrace-lwp-base
# 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)


Revision tags: yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base
# 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.


Revision tags: yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 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


Revision tags: kent-audio2-base
# 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.


Revision tags: yamt-km-base4 yamt-km-base3 netbsd-3-base
# 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.


Revision tags: yamt-km-base2
# 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.


Revision tags: yamt-km-base kent-audio1-beforemerge bouyer-xen2-base kent-audio1-base
# 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


Revision tags: netbsd-2-0-base
# 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.143 15-Dec-2016 kamil

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>


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.141 20-May-2016 jnemeth

make CPU microcode loading dependent on both DOM0OPS AND CPU_UCODE


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 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


Revision tags: nick-nhusb-base-20151226
# 1.138 11-Nov-2015 skrll

Fix XEN build - does XEN really want/need pmap_pv_track?


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 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


Revision tags: nick-nhusb-base
# 1.134 11-Oct-2014 uebayasi

branches: 1.134.2;
Mark machdep files.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.133 12-Feb-2014 dsl

branches: 1.133.4;
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!


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 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@


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase
# 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.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 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.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 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.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3
# 1.99 30-Apr-2009 pgoyette

Include cpu_topology.c for xen kernels, too.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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.


Revision tags: mjf-devfs2-base
# 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.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 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.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 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.


Revision tags: yamt-nfs-mp-base
# 1.84 25-Apr-2008 ad

branches: 1.84.2; 1.84.4;
Include null IPI functions if !MULTIPROCESSOR.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.83 27-Feb-2008 dogcow

branches: 1.83.2;
fix longrun build borkage on i386


Revision tags: nick-net80211-sync-base
# 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.


Revision tags: mjf-devfs-base
# 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.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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.


Revision tags: matt-armv6-base
# 1.76 01-Jan-2008 yamt

try to detect processor resource sharing topologies. ie. package/core/smt IDs.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: bouyer-xenamd64-base
# 1.70 22-Nov-2007 yamt

remove lock_machdep.c


Revision tags: bouyer-xenamd64-base2
# 1.69 15-Nov-2007 ad

Remove support for 80386 level CPUs. PR port-i386/36163.


Revision tags: jmcneill-base
# 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.


Revision tags: yamt-x86pmap-base4
# 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.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 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.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 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.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 1.56 18-Feb-2007 dsl

Get config(1) to supply the default values for BEEP_ONHALT.


Revision tags: post-newlock2-merge
# 1.55 09-Feb-2007 ad

branches: 1.55.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 newlock2-base
# 1.54 18-Dec-2006 gdt

Use agp_machdep.c from the new location (x86, not i386).


Revision tags: yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 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@.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.46 11-Aug-2006 yamt

branches: 1.46.2; 1.46.4;
"xm shutdown" support for xen3. ok'ed by Manuel Bouyer.


Revision tags: abandoned-netbsd-4-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 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.


Revision tags: yamt-pdpolicy-base5
# 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.


Revision tags: yamt-pdpolicy-base4 elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base3
# 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().


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 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.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 ktrace-lwp-base
# 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)


Revision tags: yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base
# 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.


Revision tags: yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 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


Revision tags: kent-audio2-base
# 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.


Revision tags: yamt-km-base4 yamt-km-base3 netbsd-3-base
# 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.


Revision tags: yamt-km-base2
# 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.


Revision tags: yamt-km-base kent-audio1-beforemerge bouyer-xen2-base kent-audio1-base
# 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


Revision tags: netbsd-2-0-base
# 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/)