Commit Graph

205 Commits

Author SHA1 Message Date
dyoung
098e562dfd Explicitly #include <sys/device.h> and <sys/evcnt.h>. These files only
got the definitions they needed by chance, before.
2009-03-27 15:47:33 +00:00
bouyer
f5f016d356 More i386PAE fixes:
- x86_round_page, x86_trunc_page, x86_btop and x86_ptob macros are used with
  physical addresses; cast to paddr_t instead of u_long. Issue pointed out
  by jym@
- machine_to_phys_mapping[] is a long. This is fine as it holds page
  frame numbers (and this fits in a 32bit int as physical addresses are
  only 36bits), but cast to paddr_t before << PAGE_SHIFT
- xen_start_info.store_mfn is a long; cast it to paddr_t before << PAGE_SHIFT.
  should fix issue pointed out by cegger@
2009-03-10 20:05:30 +00:00
bouyer
ad86c9a128 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.
2009-02-13 21:03:59 +00:00
cegger
23c2bff805 apply fix from upstream:
pciif: Fix typo in constant definition.


xen-unstable changeset: 19190
xen-3.3-testing changeset: 18580
2009-02-13 10:35:48 +00:00
jym
f0ba6e4c1b Replace x86 memory fences in Xen drivers by their Xen equivalents, to reduce
MD dependency:

x86_lfence() => xen_rmb()
x86_sfence() => xen_wmb()
x86_mfence() => xen_mb()

Discussed in
http://mail-index.netbsd.org/port-xen/2009/01/15/msg004655.html

Ok by bouyer@.
2009-01-16 20:16:47 +00:00
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
8bf1049561 make this header compile standalone 2008-10-30 09:24:37 +00:00
cegger
e91b443503 make this header standalone 2008-10-29 13:35:35 +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
b72e8c4339 catch up with amd64: add hvm_op hypercall 2008-10-21 22:35:25 +00:00
cegger
2de31871b9 introduce two macros: xendomain_is_dom0() and xendomain_is_privileged(). Use them. 2008-10-21 15:46:32 +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
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
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
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
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
bouyer
c8e9dd1af4 G/C dead code: remove now-unused softintr-related code. 2008-05-24 15:10:50 +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
martin
ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
ad
1a1d0b7f30 Include null IPI functions if !MULTIPROCESSOR. 2008-04-25 13:26:27 +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
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
e34ebae1b0 remove unused file
OK bouyer
2008-04-04 20:15:07 +00:00
ichiro
f742db2180 make compile
- add xenbus_read_ull prototype into include/xenbus.h
2008-03-14 02:17:15 +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
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
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
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
joerg
34dc4c6501 Switch Xen to generic TODR. Tested by Manuel Bouyer. 2008-01-08 20:37:34 +00:00
yamt
a0958af97a g/c ci_idle_pcb_paddr 2008-01-05 21:37:25 +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
yamt
cfb66876d1 try to detect processor resource sharing topologies. ie. package/core/smt IDs. 2008-01-01 20:32:10 +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
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
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
ad
a0b58b4601 Remove remaining CPUCLASS_386 tests. 2007-11-28 16:44:46 +00:00