Commit Graph

696 Commits

Author SHA1 Message Date
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