Commit Graph

250 Commits

Author SHA1 Message Date
bouyer a9cd17640d Add missing __KERNEL_RCSID() 2008-02-17 14:03:16 +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
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
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
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
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
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 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 7960b954d7 Don't clear ci_want_resched in MD code; it's done in mi_switch(). 2007-12-02 16:37:58 +00:00
bouyer ec3e8e5c1c xpq_flush_queue(): cast values to u_int64_t and use PRIx64 in printf().
Fix build of i386 Xen kernels, reported by Hisashi T Fujinaka.
2007-11-23 09:54:33 +00:00
bouyer 4e54134323 Pull up the bouyer-xenamd64 branch to HEAD. This brings in amd64 support
to NetBSD/Xen, both Dom0 and DomU.
2007-11-22 16:16:40 +00:00
ad d3cd7e49e7 Remove pccons. 2007-11-14 17:58:50 +00:00
ad 9c412e0cbf 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.
2007-09-26 19:48:34 +00:00
christos 53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
bouyer dd27ab284c Properly honnor bus_dma bus address range restriction for Xen3 (the Xen2
interface doesn't allow it), so that .e.g bus_dma_subregion() has a chance
to work. Unfortunably a stock Xen hypervisor won't allow a upper bound less
than 2^31 (2GB) so devices like bce(4) will need a hacked hypervisor to
work properly.
2007-02-24 21:19:25 +00:00
thorpej ae01c745cb TRUE -> true, FALSE -> false 2007-02-22 06:47:16 +00:00
hubertf eda05c6413 Remove more duplicate headers.
Patch by Slava Semushin <slava.semushin@gmail.com>

Again, this was tested by comparing obj files from a pristine and a patched
source tree against an i386/ALL kernel, and also for src/sbin/fsck_ffs,
src/sbin/fsdb and src/usr.sbin/makefs. Only changes in assert() line numbers
were detected in 'objdump -d' output.
2007-01-29 01:52:43 +00:00
bouyer 8f9ec90387 Remove extra ) causing compile failure when CONS_OVERRIDE is defined.
From Hideo Masuda in PR port-xen/35217.
2006-12-09 10:37:52 +00:00
yamt 98cfc473c8 - pass intrframe by-pointer, not by-value.
- make i386 and xen use per-cpu interrupt stack.

xen part is reviewed by Manuel Bouyer.
2006-12-08 15:05:18 +00:00
yamt cbba26f6cd include machine/mpconfig.h so that these files can be compiled
with ACPI but without MPBIOS.
2006-10-15 13:31:18 +00:00
yamt 24a777197d intr_establish: add a missing ";" in the case of NIOAPIC==0. 2006-10-12 09:01:02 +00:00
bouyer f23d3bb7be 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.
2006-09-28 18:53:15 +00:00
bouyer caeb885a9b Wrap some printfs in #ifdef DEBUG, as we should not leak memory any more when
bus_dma memory allocation fails.
2006-09-03 19:04:20 +00:00
bouyer aeeb0b33ca Some bus_dma(9) fixes for Xen:
- Attempt to gracefully recover from a failed decrease_reservation or
  increase_reservation, by avoiding physical memory loss.
- always store a machine address in ds_addr; this avoids some mistakes
  where machine address would in some case be freed at physical address, or
  mapped as physical address.
2006-08-28 19:58:56 +00:00
bouyer aab0004b68 Add support for ACPI in xen-3 dom0 support. We can now boot a xen-3 dom0
kernel with a default xen comamnd line.
2006-04-09 19:28:00 +00:00
bouyer 8f162b7ed8 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.
2006-01-15 22:09:51 +00:00
perry 50a256a3a0 __asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
2005-12-24 23:23:59 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
yamt bc21da4cfb bus_dmamem_map: honour BUS_DMA_NOWAIT. noted by Manuel Bouyer.
bus_space_map: always do NOWAIT allocation as it used to be before yamt-km.

we have too many copies!
2005-11-24 13:08:32 +00:00
bouyer e6a6daf84f Fix a memory leak. Thanks to YAMAMOTO Takashi for the notice. 2005-08-22 11:04:10 +00:00
bouyer cd1cc7810a Also properly check the alignement and boundary constraints. 2005-08-20 20:06:24 +00:00
bouyer 0944c0fa9d 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.
2005-08-20 19:30:37 +00:00
bouyer 15ce68ccd1 Allow compiling a domain0 kernel with vga but without pckbc, and add
console support for USB keyboard. Problem pointed out by Karl Janmar on
port-xen.
2005-06-16 10:58:52 +00:00
bouyer c17413ff3e Get rid of the event to pseudo-irq mapping. We are limited to 32 pseudo-irq,
including soft interrupt, and this is way too low in some use (lots of domains,
or domains with lots of xennet, or even hardware with lots of devices at
different interrupts).
Based on idea from YAMAMOTO Takashi, keep one list of handler per-event and
one per-IPL (so the same handler is now in 2 lists). In the common case were
an event is received at low IPL, we can call the handlers quickly (there
is usually only one handler per event, unless the event is mapped to a
physical interrupt and this interrupt is shared by different devices).
Deffered events and software interrupts are handled by a bitmask (as before)
with one bit per IPL. When one IPL has an event pending all handlers for
this IPL will be called.
With this change, it is now possible to have all the 1024 events active.

While here, handle debug event in a special way: the handler is always called,
regardless of the current IPL. Make the handler print usefull informations
about events and IPL states.
Also remove code not used on Xen in files inherited from the x86 port.
2005-04-16 22:49:37 +00:00
yamt fb4a1ff192 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.
2005-04-16 07:53:35 +00:00
yamt f12efb9990 fix a bug which corrupts runqueue.
when dealing with events, which are handed to xenevt pseudo device,
don't call wakeup(9)/selnotify(9) at too high IPL.  PR/29792.
2005-04-11 12:10:31 +00:00
yamt 6b2d8b66a4 merge yamt-km branch.
- don't use managed mappings/backing objects for wired memory allocations.
  save some resources like pv_entry.  also fix (most of) PR/27030.
- simplify kernel memory management API.
- simplify pmap bootstrap of some ports.
- some related cleanups.
2005-04-01 11:59:21 +00:00
matt 290234fa8a Update to new bus_dma semantics. 2005-03-10 00:20:54 +00:00
bouyer e9666f30ad 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.
2005-03-09 22:39:19 +00:00
yamt c0ebe301d7 don't reference kernel_lock directly. 2004-10-23 21:27:33 +00:00
cl f720882cf0 Rework the physical<->machine memory mapping: offset physical addresses
by 0x100000 (above the I/O Memory "hole") leaving all physical addresses
below unused, don't perform phys<->mach mapping for addresses below 0x100000
or beyond the real hardware's physical memory.

-> /dev/mem works now as expected and X works in domain0.
2004-04-26 22:05:04 +00:00
cl f53151522e Enable keyboard and vga display as console when running as domain-0. 2004-04-24 21:45:58 +00:00
cl fb658556ac Make bus_space map machine addresses instead of physical addresses. 2004-04-24 19:18:01 +00:00
cl fb65e916fb Consistently use xencons for eveything reffering to Xen's virtual console.
rename arch/xen/xen/console.c -> arch/xen/xen/xencons.c
2004-04-24 18:24:14 +00:00
cl d145eca4fb catch up with arch/x86/x86/intr.c
1.15/kochi
use designated initializer for struct pic initializers.
just for readability.

update the xenev_pic initializer as well
2004-04-11 00:18:29 +00:00
cl 41d325dc43 Add port to the Xen virtual machine monitor.
(see http://www.cl.cam.ac.uk/Research/SRG/netos/xen/)
2004-03-11 21:44:08 +00:00