Commit Graph

827 Commits

Author SHA1 Message Date
cegger
5bed9654a4 Finish preparation to new interface.
New interface not yet used by default. It needs some testing first.
2008-11-13 18:44:51 +00:00
cegger
f3a877306a add platform_op hypercall (already exists for amd64) 2008-11-13 18:35:20 +00:00
cegger
cc63733c55 prepare move to new interface 2008-11-13 01:45:48 +00:00
cegger
32c1f8c732 Nuke last parameter from mpaci_scan_apics() and mpbios_scan().
It is unused.
2008-11-09 14:24:14 +00:00
cegger
4b9b87ae5b Link cpus in the order they are attaching and not in inverse order. 2008-11-06 19:29:46 +00:00
bouyer
b9e39927ac evtchn_do_event(): in our C implementation of spllower(), if a handler fails
to restore the spl (shouldn't happen, but ...), we could end up with a
higther pending ipl set and never cleared because iplbit already
handled this level. while (iplmask != 0) {} would then never be true,
and we'd end up triggering KASSERT(iplbit != 0).
Now print the faultly handler and reset the IPL, and start the whole
pending IPL handling again if needed.
2008-11-05 21:04:05 +00:00
rmind
8f1873ea3b - Avoid the race with CPU online/offline state changes, when setting the
affinity (cpu_lock protects these operations now).
- Disallow setting of state of CPU to to offline, if there are bound LWPs,
  which have no CPU to migrate.
- Disallow setting of affinity for the LWP(s), if all CPUs in the dynamic
  CPU-set are offline.
- sched_setaffinity: fix invalid check of kcpuset_isset().
- Rename cpu_setonline() to cpu_setstate().

Should fix PR/39349.
2008-10-31 00:36:22 +00:00
joerg
77a5d43962 New assym.h dependency. 2008-10-30 20:07:01 +00:00
cegger
2243bd9791 twiddle with headers: include what is really needed 2008-10-30 10:12:59 +00:00
cegger
8bf1049561 make this header compile standalone 2008-10-30 09:24:37 +00:00
cegger
77abfb89c8 include <xen/xen.h> for xendomain_is_dom0() 2008-10-29 13:53:15 +00:00
cegger
e91b443503 make this header standalone 2008-10-29 13:35:35 +00:00
cegger
c479884027 change nfs boot behaviour to automatically try next boot method if boot information are incomplete to succeed.
That way, it is possible combine static and dhcp boot:
  For example, to boot diskless you can specify the nfs-server and the rootpath statically. All other information will be taken via dhcp.

Patch has been presented on port-xen, tech-kern and tech-net:
http://mail-index.netbsd.org/port-xen/2008/10/24/msg004488.html
http://mail-index.netbsd.org/tech-kern/2008/10/24/msg003255.html
http://mail-index.netbsd.org/tech-net/2008/10/24/msg000864.html

No comments, no objections.
2008-10-27 10:58:22 +00:00
apb
f46c1de7cb Use ${TOOL_SED} instead if plain sed in Makefiles. 2008-10-25 22:27:34 +00:00
jym
e9dd42b127 - add and fix some comments in xennet and xbd code
- add BEST_SUSPENDED macro, the xennet equivalent of BLKIF_STATE_SUSPENDED
for xbd (indicate that backend is in suspended state)
- use GNTST_okay to check the grant table setup status returned by hypercall,
 rather than 0

No functional changes.
2008-10-25 17:12:29 +00:00
jym
37061b265d - add mfn_to_pfn() and pfn_to_mfn() macros, for rapid conversion between
pseudo-physical and machine frame numbers.

- add HYPERVISOR_crash() for i386 and amd64. Intended to be used by a domain
to notify Xen that it crashed on purpose, and request a dump (if applicable).

No functional changes intended.

Reviewed by Christoph (cegger@).
2008-10-24 22:06:06 +00:00
jym
4f26afe701 - rename init_events() to events_init(), to better reflect netbsd semantics
- change unbind_[pv]irq_from_evtch() so that they now return the event
channel the [PV]IRQ was bound to. It reflects the opposite behaviour of the
bind_[pv]irq_to_evtch() functions.

- remove xenbus_suspend() and xenbus_resume() prototypes, as they are not
used anywhere else, and will conflict with the xenbus pmf(9) handlers.

- make start_info aligned on a page boundary, as Xen expects it to be so.

- mask event channel during xbd detach before removing its handler (can
avoid spurious events).

- add the "protocol" entry in xenstore during xbd initialization. Normally
created during domU's boot by xentools, it is under domU's responsibility
in all other cases (save/restore, hot plugging, etc.).

- modifications to xs_init(), so that it can properly return an error.

Reviewed by Christoph (cegger@).
2008-10-24 21:09:24 +00:00
jym
507459d7a0 - printf -> aprint_*
- fix and add comments
- make some panic/error messages more relevant
- remove last '\n' in DPRINTK() macros, not required as it is already part of format string.

No functional changes.
2008-10-24 18:02:58 +00:00
cegger
5cbbf5c20d findroot(): set booted_device also when specifying a network device to bootdev.
Useful for booting with root on nfs.
2008-10-24 16:37:25 +00:00
cegger
7f01a821b9 struct device * -> device_t 2008-10-24 16:26:07 +00:00
cegger
b72e8c4339 catch up with amd64: add hvm_op hypercall 2008-10-21 22:35:25 +00:00
cegger
397d181874 The 'sc' in xenbus_sc implies a softc, but it is actually a device_t. Since the device_t/softc split you can't cast a softc out of a device and vice versa.
Therefore rename xenbus_sc to xenbus_dev to prevent any possible confusions.
2008-10-21 21:55:44 +00:00
cegger
7395238cc5 xenbus_probe_init():
- use xendomain_is_dom0()  (from jym@)
- replace return with kthread_exit(0)  (from jym@)
- cleanup error handling
- plug memory leak in error path
- use aprint_error_dev for error messages (from jym@)

xenbus_attach():
- use aprint_error_dev for error message
2008-10-21 21:28:05 +00:00
cegger
2de31871b9 introduce two macros: xendomain_is_dom0() and xendomain_is_privileged(). Use them. 2008-10-21 15:46:32 +00:00
apb
96230fab84 Use ${TOOL_AWK} instead of ${AWK} or plain "awk" in make commands.
Pass AWK=${TOOL_AWK:Q} to shell scripts that use awk.
2008-10-19 22:05:19 +00:00
bouyer
f1567130a6 Don't use a pointer to vm_map_entry after releasing the vm_map_lock().
Pointed out by yamt@.
2008-10-18 16:59:52 +00:00
jym
b84e0297d7 Add checks to avoid possible calls to kmem_alloc() with 0 values.
Approved by bouyer.
2008-10-17 22:16:37 +00:00
bouyer
9fac915750 Support 64bit DMA on PCI busses. 2008-10-11 21:11:11 +00:00
bouyer
d0d4dde4ac Fix IOCTL_PRIVCMD_MMAPBATCH: don't blindly map requested pages read/write
but use the map's protection bits, as the hypervisor may refuse read/write
mappings for some entries. Now suspend/resume of domUs should work
from a NetBSD dom0, provided that the domU's kernel supports it.

From Jean-Yves Migeon.
2008-09-20 20:36:09 +00:00
bouyer
6004aef42d Implement the arch-dependent p2m frame lists list. This adds support for
'xm dump-core' for NetBSD domUs.
From Jean-Yves Migeon (jean-yves dot migeon at espci dot fr)
2008-09-16 19:55:31 +00:00
bouyer
dca35a7e77 Fix typos and pasto, from Jean-Yves Migeon (jean-yves dot migeon at espci
dot fr). Luckily this pasto is fatal only in case of a 64bit domU on a
32bit dom0, which we don't support yet as dom0.
2008-09-16 19:53:05 +00:00
tron
0f256b9d59 Compile NetBSD/amd64 kernels with "-Wextra". Patches contributed by
Juan RP in PR port-amd64/39266.
2008-09-05 13:37:24 +00:00
cegger
2dd3a5d650 Add machine check hypercall.
There will be one file where this will be used. In the initialization a hypervisor version check will verify, if this feature is usable or not.
2008-08-25 09:21:45 +00:00
bouyer
3d5ae4c8b2 Defer xbdback_do_io() to a workqueue; which allow us to take the
xbd_io->xio_buf.b_vp->v_interlock mutex before v_numoutput++;
which should fix the "vwakeup: neg numoutput" panic.
2008-08-24 21:00:49 +00:00
bouyer
fd284864b3 privcmd_xen2bsd_errno(): 0 is also a valid error code. 2008-08-24 20:35:43 +00:00
cegger
02daa3b8ab Fix build. 2008-08-22 15:28:11 +00:00
cegger
560673faf9 merge. 2008-08-22 14:14:04 +00:00
cegger
c9af55f05d Import Xen 3.3.0 public headers 2008-08-22 13:52:03 +00:00
bouyer
6523980087 printf()->aprint_debug_dev() to match x86/cpu.c 2008-08-22 10:25:58 +00:00
cegger
1e2fd53973 When shutting down or rebooting a domu, a phantom domain was left with:
> xm list
Domain-Unnamed                               1   467     1     ---s--  46.0

The root cause is a discrepancy in the error *value* codes:
BSD uses the AT&T Unix Version 6 error codes, while Xen uses
Unix System V error codes (or actually what Linux/i386 has taken over from it).

After shutting down (or rebooting) a domU, the guest container gets destroyed.
This implies freeing resources used by the guest (RAM, internal management structures, etc.).

The destroy process is an asynchronous process in order to not block the Dom0 (and other DomUs).
The destroy process works this way:

The XEN_DOMCTL_destroydomain is invoked from the xentools (python, libxc code).
XEN_DOMCTL_destroydomain hypercall calls domain_kill().
domain_kill() calls domain_relinquish_resources().
domain_relinquish_resources() calls relinquish_memory().
relinquish_memory() calls hypercall_preempt_check().

hypercall_preempt_check() makes all this asynchronous.
It fails, if there's an other hypercall pending.
In that case relinquish_memory() returns EAGAIN, which means, just retry to continue the destroy process.

EAGAIN is passed through the return path back into the python code
(= userspace). The python code checks for EAGAIN and *should*
retry, but it didn't.

In Unix System V / Linux, EAGAIN has the error code value 11.
In BSD, EAGAIN has the error code value 35 and EDEADLK has the error code value 11.

This means, Xen returning EAGAIN means for the python code EDEADLK.
This lead to the confusing error message 'domain destroy failed due to Resource Deadlock avoided'.

We finally convert the error code from the Xen hypercall to BSD before passing it upstream.
2008-08-19 15:14:43 +00:00
cegger
09a68d0ddb IOCTL_PRIVCMD_MMAPBATCH used guest physical address 0x0 to mark a page as invalid.
Since we have to treat 0x0 as a valid page, this got broken in rev. 1.26.
Introduce INVALID_PAGE as magic value and restore the check.
This unbreaks IOCTL_PRIVCMD_MMAPBATCH while allowing to launch HVM guests.
2008-08-18 23:09:37 +00:00
cegger
d546809216 In Xen 3.2 (c/s 15985) the semantic of the HVM domain builder changed:
hvm: Avoid need for ugly setcpucontext() in HVM domain builder by
pre-setting the vcpu0 to runnable inside Xen, and have the builder
insert a JMP instruction to reach the hvmloader entry point from
address 0x0.

So we have to treat guest physical address 0x0 like every one
or we end in a page fault loop when launching a HVM guest, otherwise.

XXX Keep this for Xen2 as this change hasn't been tested there.
2008-08-16 08:02:20 +00:00
cegger
692c8bd822 - beggining -> beginning
- xenconscn_attach: ansify
- xenconscn_putc: KNF
2008-08-10 13:33:44 +00:00
joerg
9ae4651601 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.
2008-08-03 19:32:03 +00:00
bouyer
d80637780e xbd_map_align() can be called from interrupt context (though
xbd_handler()->dk_iodone()->dk_start()->xbd_start()), so don't try
to sleep in uvm_km_alloc().
2008-07-05 19:06:01 +00:00
drochner
abec36fc7a split device/softc for ioapic 2008-07-03 15:44:19 +00:00
drochner
54745077e8 Remove "struct device" from "struct pic", where it was only real
for ioapics and faked up for others. Add it to "struct ioapic_softc"
for now, until device/softc get split.
This required all typecasts between "struct pic" and "struct ioapic_softc"
to be replaced, I hope I got them all.
functionally tested on i386, compile-tested on xen, untested on amd64
2008-07-03 14:02:24 +00:00
drochner
14071b7c24 remove some obviously obsolete definitions 2008-07-02 19:18:52 +00:00
bouyer
802c7519a2 Raise ci_idepth (and switch to interrupt stack on i386) becore calling
xenevt_event().
2008-07-01 18:49:20 +00:00
bouyer
42f814d7d2 spllower(): return immediatly if ci->ci_ilevel <= nlevel, as the asm
versions do.
2008-07-01 18:44:50 +00:00
cegger
d0c2dda1a1 correct spelling in error message 2008-06-13 22:59:03 +00:00
cegger
78be369e90 xbddump: remove duplicate check done by device_lookup_private 2008-06-12 04:54:40 +00:00
briggs
3eeb707af6 Don't try to look up the softc manually in xbddump(). We already have it
from device_lookup_private().
2008-06-12 02:50:30 +00:00
bouyer
581b1e5743 Initialize ih_ilevel for the special xenevt_processevt() handler.
Should fix KASSERT panic reported by Sarton O'Brien and Kazushi Marukawa
on port-xen@
2008-06-07 20:07:42 +00:00
ad
06c343ac94 vm_page: put TAILQ_ENTRY into a union with LIST_ENTRY, so we can use both. 2008-06-04 12:41:40 +00:00
cegger
5f767a47d6 Dom0: Add a delay before registering event handlers. Wait 1s per request from bouyer.
Fixes "Hotplug scripts not working" problems when launching guests.
Reviewed by bouyer.
2008-06-02 20:54:59 +00:00
ad
48ced055d4 pci_intr_setattr(), allows PCI interrupts to be marked MPSAFE on x86, and
other platforms if the code is added.

pci_intr_map(...)
pci_intr_setattr(pc, ih, PCI_INTR_MPSAFE, 1);
pci_intr_establish(...)
2008-05-30 19:26:35 +00:00
ad
2839301d21 Add a 'known_mpsafe' argument to intr_establish(). 2008-05-30 19:03:10 +00:00
cegger
785a84e999 build fix: add missing prototype 2008-05-30 16:22:51 +00:00
ad
788aa3a3b0 Give it a private X86_MAXPROCS def. XXX 2008-05-28 12:48:21 +00:00
explorer
d4ffc0c2dd print out the xen hypervisor's version number when attaching 2008-05-27 17:01:07 +00:00
bouyer
02ac2b8d02 Add a KASSERT(): Xspllower() will reenable interrupts, so make sure it's
not wrong to do so.
2008-05-25 16:09:30 +00:00
bouyer
c8e9dd1af4 G/C dead code: remove now-unused softintr-related code. 2008-05-24 15:10:50 +00:00
bouyer
d491d792fd Remork the C implementation of spllower() in evtchn_do_event(), so that
callbacks are always called in decreasing IPL order. Although it's not
strictly a bug, it makes the code easier to read, and avoids processing
the whole IPL range several times.
2008-05-24 15:09:34 +00:00
bouyer
e0180214c9 call x86_cpu_idle_init(), avoid null function pointer call (cpu_idle()) when
scheduling starts.
cleanup printfs of vcpu
2008-05-16 17:20:01 +00:00
ad
bfff830416 Fix typo. 2008-05-11 16:25:46 +00:00
ad
b698c03c2c Don't reload LDTR unless a new value, which only happens for USER_LDT. 2008-05-11 16:23:05 +00:00
ad
3cd3c8ccbc Stop using APIC IDs to identify CPUs for software purposes. Allows for
APIC IDs beyond 31, which has been possible for some time now.
2008-05-11 15:59:50 +00:00
ad
f674d9678b Share cpu.h between the x86 ports. 2008-05-11 15:32:20 +00:00
ad
c5fb1571ad Update xen for identcpu changes. 2008-05-11 15:02:34 +00:00
ad
95a272a377 Make xen build after tsc changes. 2008-05-10 16:27:57 +00:00
joerg
a790b941e6 Make cpu_idle a macro calling a function pointer on x86.
Select the Xen idle routine for Xen, mwait if supported by the CPU and
it is not AMD and halt otherwise. As reported by Christoph Egger,
AMD Barcelona keeps the CPU in C0 state with MWAIT, contrary to HLT,
which uses C1 and therefore much less power.
2008-05-09 18:11:28 +00:00
ad
2f3850d422 Export tsc_freq via sysctl. 2008-05-05 17:47:06 +00:00
cegger
46512505a9 Update headers: Welcome Xen 3.2.1
Important note: This does not break backward-compatibility. It is still possible to run on Xen 3.1.4.
Hint for developers: Use the xen_version hypercall to determine at runtime if a new hypercall will work. Also check the hypercall return code.
Tested by me and bouyer. OK bouyer.
2008-05-04 19:56:28 +00:00
plunky
fcf1772a80 after the "struct disk" is finished with, it should be
destroyed with disk_destroy(9) to stave off LOCKDEBUG
panics.
2008-05-03 08:23:41 +00:00
cegger
c92d850bb3 AMD's APM Volume 2 says 'All control registers are 64bit in long mode'.
Fix the CR0 prototype to match this (the asm implementation is correct though).
OK ad
2008-04-30 00:16:30 +00:00
martin
ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
bouyer
0fef0ddf92 xengnt_more_entries(): fix memory leak, noticed by Jean-Yves Migeon 2008-04-27 19:28:45 +00:00
ad
1a1d0b7f30 Include null IPI functions if !MULTIPROCESSOR. 2008-04-25 13:26:27 +00:00
cegger
a9291fce0d keep up with x86/x86/cpu.c, rev. 1.33:
Gracefully handle a condition where apic id >= X86_MAXPROCS rather than panicing.
2008-04-24 20:44:02 +00:00
cegger
20161b7289 Access Xen's vcpu info structure per-CPU.
Tested on i386 and amd64 (both dom0 and domU) by me.
Xen2 tested (both dom0 and domU) by bouyer.
OK bouyer
2008-04-21 15:15:33 +00:00
cegger
781f72a712 Use interrupt biglock wrapper as in x86/x86/intr.c
This change is based on http://mail-index.netbsd.org/port-amd64/2004/02/22/0000.html
OK bouyer
2008-04-19 13:46:12 +00:00
cegger
e1f7ded34b g/c unused ioapic_bsp_id.
Per discussion with bouyer.
2008-04-18 15:32:46 +00:00
bouyer
ad2fcdc36d Do not set ioapic_bsp_id in cpu_attach_common(). It's already initialized
in cpu_attach(), and doing it here will overwrite the cpu_number of the
physical CPU with the one from the virtual CPU (which is always 0).
XXX is ioapic_bsp_id read somewhere ?
2008-04-17 21:25:00 +00:00
yamt
dc985aec9b cpu_debug_dump: s/curproc/curlwp/ in a message. 2008-04-17 14:01:03 +00:00
cegger
7d2699a931 reduce diff to x86/x86/cpu.c 2008-04-17 12:24:44 +00:00
cegger
19a5965092 Use device_xname(). From Manuel Bouyer. 2008-04-16 20:50:27 +00:00
cegger
af33bdeef3 device_t / softc split
reviewed, tested and approved by bouyer
2008-04-16 18:41:48 +00:00
cegger
7f5c40b741 - use POSIX integer types
- ansify functions
2008-04-14 13:38:03 +00:00
cegger
78ad08323e reduce diff to x86/x86/cpu.c 2008-04-13 22:29:38 +00:00
cegger
f578477b0b - device_t/softc split
- ansify
2008-04-13 21:59:15 +00:00
cegger
f5bd7c2196 use aprint_*_dev and device_xname 2008-04-06 07:23:57 +00:00
cegger
e34ebae1b0 remove unused file
OK bouyer
2008-04-04 20:15:07 +00:00
ad
69c15cf00b Make it compile. 2008-03-22 14:28:10 +00:00
ad
3685a3103f vn_close no longer takes a 'struct lwp' argument. 2008-03-22 14:21:56 +00:00
ichiro
f742db2180 make compile
- add xenbus_read_ull prototype into include/xenbus.h
2008-03-14 02:17:15 +00:00
bouyer
9cde455f5c Add swedge support to xbd backed, and make the virtual block device handle
sizes larger than 4TB. Tested by Jukka Marin.
Should fix kern/37370.
2008-03-13 22:19:39 +00:00
bouyer
b097a67b1d Implement a C version of splx() in evtchn_do_event(). using plain splx()
here will reenable interrupts as a side effect, and we don't want it here.

It could cause some event handlers to run twice (which should be harmless),
and trap() to be called on the wrong LWP in doreti_checkast (which can
probably cause some damage).
2008-03-13 22:04:57 +00:00
cube
ade3d15dc2 Don't forget to set sc_dev. 2008-03-05 04:58:29 +00:00
cube
521d00a805 Convert the Xen attachment for npx(4), too. 2008-03-04 15:02:52 +00:00
rmind
85fcf08240 Fix my previous confuse of the code: use selinit/seldestroy in correct
places, and fix missed selnotify call.
2008-03-01 18:32:48 +00:00
rmind
c6186face4 Welcome to 4.99.55:
- Add a lot of missing selinit() and seldestroy() calls.

- Merge selwakeup() and selnotify() calls into a single selnotify().

- Add an additional 'events' argument to selnotify() call.  It will
  indicate which event (POLL_IN, POLL_OUT, etc) happen.  If unknown,
  zero may be used.

Note: please pass appropriate value of 'events' where possible.
Proposed on: <tech-kern>
2008-03-01 14:16:49 +00:00
dogcow
9b1ad79147 fix longrun build borkage on i386 2008-02-27 04:19:24 +00:00
drochner
bb33f35f20 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.
2008-02-20 21:43:33 +00:00
bouyer
af1d7cb986 The event bitmasks provided by the hypervisor are unsigned long (so 64bits
on amd64). Make sure to use the right type to store and manipulate them.
This fixes amd64, where basically any event channel > 31 was not working
(and you get there after starting/stopping a domU a few times). Things
would occasionally unwedge though the spllower() callbacks.
2008-02-19 19:50:53 +00:00
bouyer
e3e720d87d Fix xenevt to not call softint_schedule() above IPL_HIGH:
Register a ipl callback for IPL_HIGH.
if the current ipl level is too high, just record the event in a bitmap,
and record IPL_HIGH as pending. The callback will process the pending events.
2008-02-19 13:25:53 +00:00
bouyer
532742d958 The informations about console and store page number are long, so avoid
overflow on i386PAE when converting to machine address. Fix booting
XEN3PAE kernels when xen maps it above 4Gb.
2008-02-17 17:39:42 +00:00
bouyer
2720c9d6a3 Install xenio.h and xenio3.h in /usr/include/xen, for the benefit
of xentools3.

XXX ignore those in Makefile.ioctl-c, they don't compile properly outside
of the Xen context and the ioctls from xenio.h conflicts with
soundcard.h
2008-02-17 16:23:12 +00:00
bouyer
895da00e0d Fix IOCTL_PRIVCMD_HYPERCALL issue which shows up with xen-3.1.3:
some hypercalls results are returned though the error path (depending on
sign, it's an error code or a result), and some results are interpreted in
a special way by the NetBSD kernel (e.g. -1).
Add a 'retval' member to the privcmd_hypercall_t argument, which holds
the hypercall result if it completed without error. The error code
is returned via the usual error path.
Handle the old IOCTL_PRIVCMD_HYPERCALL under COMPAT_40.

While there, make the double-inclusion protection #define match the
convention in xenio3.h and xenio.h.
2008-02-17 16:21:19 +00:00
bouyer
a9cd17640d Add missing __KERNEL_RCSID() 2008-02-17 14:03:16 +00:00
jmmv
af05f05499 Let Xen kernels build with "options MODULAR" enabled by pulling in the
appropriate kobj_machdep.c file.
2008-01-31 13:46:33 +00:00
joerg
6e869e402d 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.
2008-01-25 21:12:10 +00:00
bouyer
98a8e8b486 Merge the bouyer-xeni386 branch. This brings in PAE support to NetBSD xeni386
(domU only). PAE support is enabled by 'options PAE', see the new XEN3PAE_DOMU
and INSTALL_XEN3PAE_DOMU kernel config files.

See the comments in arch/i386/include/{pte.h,pmap.h} to see how it works.
In short, we still handle it as a 2-level MMU, with the second level page
directory being 4 pages in size. pmap switching is done by switching the
L2 pages in the L3 entries, instead of loading %cr3. This is almost required
by Xen, which handle the last L2 page (the one mapping 0xc0000000 - 0xffffffff)
in a very special way. But this approach should also work for native PAE
support if ever supported (in fact, the pmap should almost suport native
PAE, what's missing is bootstrap code in locore.S).
2008-01-23 19:46:43 +00:00
lukem
14c9fc8ffa Remove unnecessary references to config_time.h. 2008-01-17 01:56:02 +00:00
ad
dfe83e08ca Remove options MATH_EMULATE. 2008-01-16 09:37:04 +00:00
dogcow
5058ecbe4e cargo-cult copy cpu_offline_md; fixes compile on i386/x86_64 2008-01-16 02:08:49 +00:00
bouyer
3fcec0e820 Allocate one more L2 slot in xen_pmap_bootstrap() for i386.
pmap_bootstrap()/init386() wants to map a few additionnal things after
first_avail that we didn't account for, before pmap_growkernel() is
used/functionnal, and if the loaded kernel is close to the end of
the last L2 slot we loose. Should fix port-xen/37761 by YAMAMOTO Takashi.

Fix a XENPRINTF() so that low debug builds again.
2008-01-15 19:55:53 +00:00
ad
ee652e42b1 - Split crashdump code out into its own file.
- Remove NO_SPARSE_DUMP.
- Minor KNF, sprinkle static.
2008-01-12 20:03:41 +00:00
bouyer
26315d042c 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.
2008-01-11 20:00:13 +00:00
ad
e8532b7138 - Fix a memory order problem with non-interlocked mutex release.
- Give kernel_lock its own cache line.
2008-01-10 20:14:10 +00:00
bouyer
0b075efe67 Move a CLI() after .Lspllower_resume; because on Xen .Lspllower_resume
may be called from Xdoreti via iret, so with interrupts enabled.
2008-01-09 23:45:34 +00:00
joerg
34dc4c6501 Switch Xen to generic TODR. Tested by Manuel Bouyer. 2008-01-08 20:37:34 +00:00
bouyer
98b295d02d uobj->vmobjlock is a mutex these days. 2008-01-08 19:26:44 +00:00
bouyer
1ad062e684 Allocating up to 8k on stack isn't a good idea ... 2008-01-08 19:26:10 +00:00
bouyer
4507f75dd0 Fix fallout from vmlocking2: in xbdback_co_io_loop(), return the right object. 2008-01-06 12:43:42 +00:00
yamt
a0958af97a g/c ci_idle_pcb_paddr 2008-01-05 21:37:25 +00:00
bouyer
f8a26c5d3c Wrap test for debug_port in __predict_false() 2008-01-05 19:29:26 +00:00
bouyer
81873269e4 Make sure debug_port isn't used before initialized by setting it to -1. 2008-01-05 19:16:07 +00:00
ad
c29520cb1a Fix includes. 2008-01-05 00:31:50 +00:00
yamt
1c6ebd43e5 fix a bug in the previous. (per-cpu tss change)
keep iopl in pcb so that it won't lost.
2008-01-04 16:38:46 +00:00
yamt
35d91ae479 i386:
- make tss per-cpu.  this considerably speeds up context switch for,
	  at least, pentium4, where ltr instruction seems very slow.
i386, xen:
	- kill cpu_maxproc.
kvm86:
	- adapt to per-cpu tss.
	- cleanup and simplify.
	- move kvm86_mp_lock to more meaningful place.
	- disable preemption during a call.
2008-01-04 15:55:28 +00:00
joerg
02af50dd40 Add assym.h dependency. 2008-01-03 21:17:44 +00:00
joerg
956f82654b Add some missing dependencies on assym.h. 2008-01-02 12:46:23 +00:00
ad
4a780c9ae2 Merge vmlocking2 to head. 2008-01-02 11:48:20 +00:00
yamt
cfb66876d1 try to detect processor resource sharing topologies. ie. package/core/smt IDs. 2008-01-01 20:32:10 +00:00
yamt
aa3e923c59 add some dependencies on assym.h. 2008-01-01 11:35:33 +00:00
yamt
2cbcb46f49 - share idt entry allocation code among x86.
- introduce a function to reserve an idt entry and use it instead of
  manipulating idt_allocmap directly.
- rename idt to xen_idt for amd64 xen.  add missing #ifdef XEN.
2007-12-26 11:51:10 +00:00
perry
b6a2ef7569 Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h
2007-12-25 18:33:32 +00:00
ad
e16a661bf3 - Make __cpu_simple_lock and similar real functions and patch at runtime.
- Remove old x86 atomic ops.
- Drop text alignment back to 16 on i386 (really, this time).
- Minor cleanup.
2007-12-20 23:46:10 +00:00
joerg
870cffb0ab Add new IPI for saving CPU state explicitly, share high-level part of
ACPI wakeup code and teach it how to start the APs again. As a side
effect the CPU_START interface allows choosing between different
bootstrap codes more easily now.
2007-12-18 07:17:08 +00:00
joerg
599a3a8e85 Revert, fixed differently. 2007-12-17 14:11:53 +00:00
jmcneill
381f4068ae Provide a stub acpi_md_sleep_init on xen, pointed out by Paul Goyette
on current-users.
2007-12-15 19:24:17 +00:00
perry
9b2b412c19 __FUNCTION__ -> __func__ 2007-12-15 00:39:14 +00:00
bouyer
ca0831b58a Remove obsolete code and comment. 2007-12-13 21:42:06 +00:00
bouyer
e2b280eabb cleanup the debug event handler to not use the IPL system at all. Fix
debug event storm on XEN2.
2007-12-12 22:16:32 +00:00
bouyer
200e86ecad Initialize ci_idepth in cpu_info_primary, makes LOCKDEBUG kernels boot. 2007-12-12 19:25:38 +00:00
bouyer
9ef60ea019 Make Xen kernels build again. 2007-12-10 13:39:06 +00:00
ad
065b6ba2fb lockmgr -> mutex 2007-12-06 17:00:31 +00:00
ad
4b293a84e1 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.
2007-12-03 15:33:00 +00:00
bouyer
eae5f92d0c IOCTL_PRIVCMD_MMAP*: instead of brutally enterring the new entries in
the process page table, properly uvm_unmap1() the VA range and enter a new
uvm_map backed by an object. There is a know race between uvm_unmap1() and
uvm_map(), where another thread could get our VA range; in practice
I think none of the softwares using this interface are multithreaded (or at
last they are single-threaded when using it).
2007-12-02 18:29:54 +00:00