Commit Graph

852 Commits

Author SHA1 Message Date
dyoung
090e16c442 Add a new member, pc_super, to x86's pci_chipset_tag: pc.pc_super points
to the tag that pc inherits its behavior from.  Add code to deal with
pc.pc_super.

Pull identical declarations out of xen/include/pci_machdep.h and
x86/include/pci_machdep.h into x86/include/pci_machdep_common.h.
2010-03-14 20:19:06 +00:00
jym
d0a75a07db Although Xen's documentation states that the address_bits field is not used
by XENMEM_decrease_reservation, it is checked by the hypervisor. In certain
circumstances (stack leak), the field could have an improper value, leading
to a fail of the hypercall.

Set it to 0 ("no addressing restriction") to avoid that.

Patch tested by Sam Fourman and haad@.

This should fix the rare "failed allocating DMA memory" encountered
under NetBSD dom0. Will ask for a pull-up.
2010-03-09 23:12:06 +00:00
jym
56436d584f Use roundup2() instead of hardcoding the CACHE_LINE_SIZE rounding
operation.
2010-03-03 00:09:03 +00:00
dyoung
f1de56229c Re-zero the attach args before setting them up for a new call to
config_found_ia().  In this way we avoid passing an uninitialized
pcibus_attach_args.pba_pc that will cause problems, later.
2010-03-02 16:44:08 +00:00
jym
13da824d1b Catch the return value from the XENMEM_decrease_reservation hypercall,
and not some error value stored earlier.

While here, fix a typo in a comment.
2010-03-02 00:13:50 +00:00
jym
4077310cda Make a XENMEM_decrease_reservation DEBUG printf() more meaningful. 2010-02-27 09:22:40 +00:00
jym
42e5342a52 Fixes regarding paddr_t/pd_entry_t types in MD x86 code, exposed by PAE:
- NBPD_* macros are set to the types that better match their architecture
(UL for i386 and amd64, ULL for i386 PAE) - will revisit when paddr_t is
set to 64 bits for i386 non-PAE.

- type fixes in printf/printk messages (Use PRIxPADDR when printing paddr_t
values, instead of %lx - paddr_t/pd_entry_t being 64 bits with PAE)

- remove casts that are no more needed now that Xen2 support has been dropped

Some fixes are from jmorse@ patches for PAE.

Compile + tested for i386 GENERIC and XEN3 kernels. Only compile tested for
amd64.

Reviewed by bouyer@.

See also http://mail-index.netbsd.org/tech-kern/2010/02/22/msg007373.html
2010-02-26 19:25:07 +00:00
dyoung
512b7322ce Fix Xen.
XXX Almost everything in this header file, x86, amd64, and i386 should
XXX share.
2010-02-25 22:20:03 +00:00
dyoung
c1b390d493 A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.
2010-02-24 22:37:54 +00:00
dyoung
871ebd4c6d Declare pci_mode_set(). 2010-02-16 00:47:46 +00:00
dyoung
515dca997f Get pci_mode out of the global namespace. 2010-02-15 23:55:24 +00:00
dyoung
2e4dbd90d6 Don't use the global variable pci_mode, but use a local copy of
the return value of pci_mode_detect(), instead.
2010-02-15 23:53:07 +00:00
jym
499833724f Starting with Xen 3 API, MMU_EXTENDED_COMMAND (tlb flush, cache flush, page
pinning/unpinning, set_ldt, invlpg) operations cannot be queued in the
xpq_queue[] any more, as they use their own specific hypercall, mmuext_op().

Their associated xpq_queue_*() functions already call xpq_flush_queue()
before issuing the mmuext_op() hypercall, which makes these xpq_flush_queue()
calls not necessary.

Rapidly discussed with bouyer@ in private mail. XEN3_DOM0/XEN3PAE_DOM0 tested
through a build.sh release, amd64 was only compile tested. No regression
expected.
2010-02-12 01:55:45 +00:00
bouyer
66e2cc3a3e Enlarge temporary buffer, so that event counter's name is not truncated
for ioapic interrupts.
2010-02-06 17:48:54 +00:00
uebayasi
32afd183da Typo in a wchan string. 2010-02-06 03:06:42 +00:00
haad
d636871e36 Finaly fix problems with using WEDGE like devices as xen backend devices. 2010-01-24 04:06:31 +00:00
cegger
51023c610c fix address overflow with 32bit PAE.
Reported and tested by Mark Davies on port-xen@.
2010-01-23 22:32:42 +00:00
bouyer
7f3017c5d2 Use paddr_t to store physical address and cast mfn values to paddr_t
before shift. Fix overflow issue preventing xend from working as
reported by Mark Davies on port-xen@
2010-01-23 18:26:37 +00:00
pooka
10fe49d72c Redefine bpf linkage through an always present op vector, i.e.
#if NBPFILTER is no longer required in the client.  This change
doesn't yet add support for loading bpf as a module, since drivers
can register before bpf is attached.  However, callers of bpf can
now be modularized.

Dynamically loadable bpf could probably be done fairly easily with
coordination from the stub driver and the real driver by registering
attachments in the stub before the real driver is loaded and doing
a handoff.  ... and I'm not going to ponder the depths of unload
here.

Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.
2010-01-19 22:06:18 +00:00
haad
b7a32bf196 Fix problem where xbdi->xbdi_size was set to 0 after succesfull DIOCGWEDGEINFO
call. Problem reported in private mail.
2010-01-17 12:08:29 +00:00
dyoung
3022acc4eb Expand PMF_FN_* macros. 2010-01-08 19:42:11 +00:00
dsl
2a54322c7b If a multithreaded app closes an fd while another thread is blocked in
read/write/accept, then the expectation is that the blocked thread will
exit and the close complete.
Since only one fd is affected, but many fd can refer to the same file,
the close code can only request the fs code unblock with ERESTART.
Fixed for pipes and sockets, ERESTART will only be generated after such
a close - so there should be no change for other programs.
Also rename fo_abort() to fo_restart() (this used to be fo_drain()).
Fixes PR/26567
2009-12-20 09:36:05 +00:00
haad
e354c714a3 Fix problem with using wedge like devicesi(LVM Logical Volumes, ZFS Zvols)
as xkbd backend. This problem was reported by Hugo Silva on port-xen.

Now we call DIOCGWEDGEINFO for all partitions, when it is not implemented
we use DIOCGPART to get information about volume size.

Fix oked by jym@.
2009-12-15 00:19:52 +00:00
tsutsui
471e528b58 Remove `volatile' qualifier from argument types of
struct timeval passed to todr_gettime(9) and todr_settime(9).
We no longer have an ancient and volatile struct timeval `time'
global since we have switched to MI timercounter(9) on all port.

XXX1: some of these RTC drivers still assume 32bit time_t
XXX2: some of these should be rewritten to use todr_[gs]ettime_ymdhms()
XXX3: todr(9) man page doesn't mention todr_[gs]ettime_ymdhms()
2009-12-12 14:44:08 +00:00
dsl
7a42c833db Rename fo_drain() to fo_abort(), 'drain' is used to mean 'wait for output
do drain' in many places, whereas fo_drain() was called in order to force
blocking read()/write() etc calls to return to userspace so that a close()
call from a different thread can complete.
In the sockets code comment out the broken code in the inner function,
it was being called from compat code.
2009-12-09 21:32:58 +00:00
rmind
3f18fe8123 - Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places.  Reduce sys/user.h inclusions.
2009-11-27 03:23:03 +00:00
tron
7395068839 Enable SSP (Stack Smash Protection) in x86 kernels by default (except
in i386 *TINY kernels). The NetBSD/i386 "ALL" kernel is unconditionally
compiled with SSP enabled.

Change approved by the core team.
2009-11-25 17:08:08 +00:00
cegger
1b91587f84 Remove X86_MAXPROCS. This fixes PR port-xen/41755.
This also reduces diff to x86/x86/cpu.c as a nice side effect.
'looks good' bouyer@
2009-11-24 13:04:04 +00:00
rmind
448807fa21 Catch-up Xen and usermode with lwp_getpcb() and unbreak Xen build. 2009-11-21 05:54:04 +00:00
cegger
9480c51b04 Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.
2009-11-07 07:27:40 +00:00
dyoung
3976f04982 Use deviter(9) instead of accessing alldevs directly. 2009-11-06 23:09:10 +00:00
dyoung
e48f8429d1 Add a kernel configuration flag, SPLDEBUG, that activates a per-CPU log
of transitions to IPL_HIGH from lower IPLs.  SPLDEBUG is only available
on i386 and Xen kernels, today.

'options SPLDEBUG' adds instrumentation to spllower() and splraise() as
well as routines to start/stop debugging and to record IPL transitions:
spldebug_start(), spldebug_stop(), spldebug_raise(), spldebug_lower().
2009-11-03 05:23:27 +00:00
bouyer
5e31b302a3 When we stall the continuation waiting for the queued I/O to complete
in xbdback_co_cache_flush2(), we don't advance the req pointer. In this
case call xbdi_put() to compensate for the xbdi_get() that will be done again
in xbdback_co_main_loop().
Fix stalled xbdback detach that would stall the whole xenbus thread,
preventing new domU from be created.
2009-10-25 13:47:43 +00:00
snj
264f5ccd6e Drop 3rd and 4th clauses. Approved by cl@ and Keir Fraser (copyright
holders).
2009-10-23 05:10:48 +00:00
snj
0d31d3264f Remove 3rd and 4th clauses. OK cl@ (copyright holder). 2009-10-23 02:32:33 +00:00
bouyer
6d07b400dc Remove closes 3 & 4 from my licence. Lots of thanks to Soren Jacobsen
for the booring work !
2009-10-19 18:41:07 +00:00
bouyer
e4821a51fc Don't pass a NULL arg to DIOCCACHESYNC, sd(4) dereferences it.
Pass a pointer to a int initialized to 1, so that a DIOCCACHESYNC will be
forced on sd(4).
Should fix dom0 panic reported by Sarton O'Brien.
2009-10-14 18:54:00 +00:00
rmind
b619d660f4 Remove X86_IPI_WRITE_MSR (and msr_ipifuncs.c), replace all uses in drivers
with xc_broadcast().  AMD K8 PowerNow driver tested by <jakllsch>, thanks!

Closes PR/37665.
2009-10-05 23:59:30 +00:00
jmcneill
74436af5d8 add dummy opt_via_c7temp.h, spotted by Andreas Gustafsson. 2009-10-03 20:56:39 +00:00
bouyer
c709e72357 Don't disestablish a soft interrupt which has not been established. 2009-09-27 19:48:57 +00:00
bouyer
fc24e4743d Announce feature-rx-copy and feature-rx-flip.
Add support for request-rx-copy. Tested with a Debian lenny install.
Should fix PR port-xen/40650
2009-09-25 23:11:57 +00:00
bouyer
db95bc7f01 xbdback: implement and publish "feature-flush-cache".
xbd: if feature-flush-cache is present, use it for DIOCCACHESYNC.
 If not present, make DIOCCACHESYNC return EOPNOTSUPP and warn on
 first call.
Should improve WAPBL reliability of Xen guests on a NetBSD dom0.
Unfortunably not all linux guests seems to support this feature, and using
feature-write-barrier would require a B_BARRIER flag in the buffer.
2009-09-23 17:48:55 +00:00
cegger
ee0f0893eb fix botch with merging in changes from x86/x86/cpu.c:
don't use wbinvd(). Xen flushes the cache for us.
This makes DomU boot again.
Spotted by bouyer@.
2009-09-22 13:59:42 +00:00
bouyer
bd2f090e7c Allow a xbd to be detached from the domU (e.g. at shutdown). Patch tested
and adjusted by David Young, discussed on port-xen@ early august.
2009-09-21 21:59:30 +00:00
dyoung
a1ac1a18e2 isa_detach_hook() needs two arguments, the first an isa_chipset_tag_t. 2009-08-19 15:04:27 +00:00
dyoung
78e9d89046 Make the 'tags' target work by borrowing stuff from sys/arch/i386/Makefile. 2009-08-18 17:21:51 +00:00
dyoung
47b66b70d9 These are stragglers from my last commit ("Let us safely detach
the ISA bus and devices attaching to the ISA bus").  Define
isa_detach_hook() in MD ISA implementations.  Define isa_dmadestroy().
2009-08-18 17:02:00 +00:00
jmcneill
b0fb7abfad Switch to ACPICA 20090730, and update for API changes. 2009-08-18 16:41:02 +00:00
manu
a693f69b7e Build COMPAT_DARWIN and COMPAT_MACH as a Xen domU too 2009-08-16 15:35:52 +00:00
jym
bba2c41d59 Add Intel SpeedStep and AMD PowerNow! support in Xen dom0. MSR operations
are now compiled in by default.

Note that MSR support in Xen depends on its version. rdmsr() should always
succeed, but wrmsr() to certain registers can end in a NOOP. In that case,
the error will be logged (see xm dmesg).

Setting CPU frequency (SpeedStep) requires Xen 3.3 with the option
cpufreq="dom0-kernel" passed down to hypervisor during boot.

Compiled and tested for SpeedStep under i386 for XEN3_DOM0 and XEN3PAE_DOM0
by jym@. amd64 was tested by Joel Carnat.

See also http://mail-index.netbsd.org/port-xen/2009/08/02/msg005213.html .

Commit requested by bouyer@.
2009-08-05 20:15:36 +00:00