Commit Graph

716 Commits

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