marius [Mon, 25 Jul 2011 19:11:29 +0000 (19:11 +0000)]
MFC: r223984
PCIB_ALLOC_MSIX() may already fail on the first pass, f.e. when the PCI-PCI
bridge is blacklisted. In that case just return from pci_alloc_msix_method(),
otherwise we continue without a single MSI-X resource, causing subsequent
attempts to use the seemingly available resource to fail or when booting
verbose to NULL-dereference rle->start when trying to print the IRQ in
pci_alloc_msix_method().
marius [Mon, 25 Jul 2011 19:03:45 +0000 (19:03 +0000)]
MFC: r223961
- Remove redundant timecounter masking from counter_get_timecount().
- Zero the timecounter when allocation so we don't need to initialize unused
members and remove a now redundant NULL assignment.
marius [Mon, 25 Jul 2011 19:01:36 +0000 (19:01 +0000)]
MFC: r223960
- Current testing shows that (ab)using the JBC performance counter in bus
cycle mode as timecounter just works fine. My best guess is that a firmware
update has fixed this, so check at run-time whether it advances and use a
positive quality if it does. The latter will cause this timecounter to be
used instead of the tick counter based one, which just sucks for SMP.
- Remove a redundant NULL assignment from the timecounter initialization.
marius [Mon, 25 Jul 2011 18:59:45 +0000 (18:59 +0000)]
MFC: r223959
- Add a missing shift in schizo_get_timecount(). This happened to be non-fatal
as STX_CTRL_PERF_CNT_CNT0_SHIFT actually is zero, if we were using the
second counter in the upper 32 bits this would be required though as the MI
timecounter code doesn't support 64-bit counters/counter registers.
- Remove a redundant NULL assignment from the timecounter initialization.
marius [Mon, 25 Jul 2011 18:46:54 +0000 (18:46 +0000)]
MFC: r223795
Call pmap_qremove() before freeing or unwiring the pages, otherwise
there's a window during which a page can be re-used before its previous
mapping is removed.
marius [Mon, 25 Jul 2011 18:44:46 +0000 (18:44 +0000)]
MFC: r223721
UltraSPARC-IV CPUs seem to be affected by a not publicly documented
erratum causing them to trigger stray vector interrupts accompanied by a
state in which they even fault on locked TLB entries. Just retrying the
instruction in that case gets the CPU back on track though. OpenSolaris
also just ignores a certain number of stray vector interrupts.
While at it, implement the stray vector interrupt handling for SPARC64-VI
which use these for indicating uncorrectable errors in interrupt packets.
marius [Mon, 25 Jul 2011 18:41:52 +0000 (18:41 +0000)]
MFC: r223719
- For Cheetah- and Zeus-class CPUs don't flush all unlocked entries from
the TLBs in order to get rid of the user mappings but instead traverse
them an flush only the latter like we also do for the Spitfire-class.
Also flushing the unlocked kernel entries can cause instant faults which
when called from within cpu_switch() are handled with the scheduler lock
held which in turn can cause timeouts on the acquisition of the lock by
other CPUs. This was easily seen with a 16-core V890 but occasionally
also happened with 2-way machines.
While at it, move the SPARC64-V support code entirely to zeus.c. This
causes a little bit of duplication but is less confusing than partially
using Cheetah-class bits for these.
- For SPARC64-V ensure that 4-Mbyte page entries are stored in the 1024-
entry, 2-way set associative TLB.
- In {d,i}tlb_get_data_sun4u() turn off the interrupts in order to ensure
that ASI_{D,I}TLB_DATA_ACCESS_REG actually are read twice back-to-back.
Tested by: Peter Jeremy (16-core US-IV), Michael Moll (2-way SPARC64-V)
marius [Mon, 25 Jul 2011 18:32:56 +0000 (18:32 +0000)]
MFC: r223648, r223949
- In gem_reset_rx() also reset the RX MAC which is necessary in order to
get it out of a stuck condition that can be caused by GEM_MAC_RX_OVERFLOW.
- In gem_reset_rxdma() call gem_setladrf() in order to reprogram the RX
filter and restore the previous content of GEM_MAC_RX_CONFIG. While at it
consistently use the newly introduced sc_mac_rxcfg throughout the driver
instead of reading the its old content.
- Increment if_iqdrops instead of if_ierrors in case of RX buffer allocation
failure.
- According to the GEM datasheet the RX MAC should also be disabled in
gem_setladrf() before changing its configuration.
- Add error messages to gem_disable_{r,t}x() and take advantage of these
throughout the driver instead of duplicating their functionality all over
the place.
marius [Mon, 25 Jul 2011 18:28:12 +0000 (18:28 +0000)]
MFC: r223378
On machines where we don't need to lock the kernel TSB into the dTLB and
thus may basically use the entire 64-bit kernel address space reduce
VM_KMEM_SIZE_SCALE to 1 allowing kernel to use more memory.
marius [Mon, 25 Jul 2011 18:26:54 +0000 (18:26 +0000)]
MFC: r223377
On machines where we don't need to lock the kernel TSB into the dTLB and
thus may basically use the entire 64-bit kernel address space increase
the kernel virtual memory to not be limited by VM_KMEM_SIZE_MAX.
marius [Mon, 25 Jul 2011 18:23:24 +0000 (18:23 +0000)]
MFC: r223235
- As with stray vector interrupts limit the reporting of stray level
interrupts. Bringup on additional machine models repeatedly reveals
firmware that enables interrupts behind our back, causing the console
to be flooded otherwise.
- As with the regular interrupt counters using uint16_t instead of
u_long for counting the stray vector interrupts should be more than
sufficient.
- Cache the interrupt vector in intr_stray_vector().
marius [Mon, 25 Jul 2011 18:17:11 +0000 (18:17 +0000)]
MFC: r223126 (partial)
Don't include curcpu in the mask which is used as the IPI cookie as we
have to ignore it when sending the IPI anyway. Actually I can't think of
a good reason why this ever was done that way in the first place as it's
not even usefull for debugging.
marius [Mon, 25 Jul 2011 17:56:06 +0000 (17:56 +0000)]
MFC: r222840
- For the case when tl1_align(_trap) is used to call rsf_fatal via
RSF_FATAL we need to switch to alternate globals for KSTACK_CHECK just
like tl1_data_excptn(_trap) does. This is more or less cosmetic because
in case RSF_FATAL is called we're already heading south.
- Correct an END().
- Read the window state from the correct register for a CATR().
marius [Mon, 25 Jul 2011 17:54:04 +0000 (17:54 +0000)]
MFC: r222828 (partial)
- Test KTR_CPUMASK against pc_cpuid rather than pc_mid to match what the C
version does.
- Initialize global registers early in the MP startup code so PCPU can be
used.
marius [Mon, 25 Jul 2011 17:20:36 +0000 (17:20 +0000)]
MFC: r221955
- Add 10baseT as an alias for 10baseT/UTP.
- Add shorthand aliases for common media+option combinations as announced
by miibus(4) so that one can actually supply the media strings found in
the dmesg output to ifconfig(8).
marius [Mon, 25 Jul 2011 17:18:46 +0000 (17:18 +0000)]
MFC: r221954
When setting media always and not just in case of switching to IFM_AUTO
clear the options of the current media, i.e. only inherit the instance,
which matches what NetBSD does. Without this it's really non-intuitive
that the following sequence:
ifconfig bge0 media 1000baseT mediaopt full-duplex
ifconfig bge0 media 100baseTX
results in 100baseTX full-duplex to be set or that:
ifconfig bge0 media autoselect mediaopt flowcontrol
ifconfig bge0 media 1000baseT mediaopt full-duplex
tries to set 1000baseT full-duplex with flowcontrol, which isn't suported
und thus fails while the following:
ifconfig re0 media 1000baseT mediaopt flowcontrol,full-duplex
ifconfig re0 media autoselect
just switches to autoselection without flowcontrol.
marius [Mon, 25 Jul 2011 14:39:22 +0000 (14:39 +0000)]
MFC: r220931
- Use the streaming cache unless BUS_DMA_COHERENT is specified. Since
r220375 (MFC'ed to stable/8 in r221191) all drivers enabled in the
sparc64 GENERIC should be either correctly using bus_dmamap_sync(9)
calls or supply BUS_DMA_COHERENT when appropriate or as a workaround
for missing bus_dmamap_sync(9) calls (sound(4) drivers and partially
sym(4)). In at least some configurations taking advantage of the
streaming cache results in a modest performance improvement.
- Remove the memory barrier for BUS_DMASYNC_PREREAD which as the
comment already suggested is bogus.
- Add my copyright for having implemented several things like support
for the Fire and Oberon IOMMUs, taking over PROM IOMMU mappings etc.
marius [Mon, 25 Jul 2011 14:30:44 +0000 (14:30 +0000)]
MFC: r216016
Define VM_KMEM_SIZE_MAX on sparc64. Otherwise kernel built with
DEBUG_MEMGUARD panics early in kmeminit() with the message
"kmem_suballoc: bad status return of 1" because of zero "size" argument
passed to kmem_suballoc() due to "vm_kmem_size_max" being zero.
MFC: Strip any leading slashes before feeding the label to the geom_label
code. Some linux distros put mount point into the ext2fs labels, such as
'/', or '/boot', which confuses the devfs code and can cause userland
programs to fail reading /dev/ext2fs directory with weird error code.
ed [Sun, 24 Jul 2011 19:13:54 +0000 (19:13 +0000)]
MFC r223744:
Improve portability of config(8).
- Use strlen(dp->d_name) instead of the unportable dp->d_namlen. Rename
i to len to make it slightly more descriptive and prevent negative
indexing of the array.
- Replace index() by strchr().
This supposedly fixes compilation on GNU systems.
Submitted by: Robert Millan <rmh debian org> (original patch)
If we can retrieve interface address sleep for one second and try again.
This can happen during start-up, when natd starts before dhclient has a
chance to receive IP address from the upstream provider. Do this only in
background, dynamic mode.
MFC r224180:
Only the USB root HUB thread is allowed to attach and detach drivers
to and from USB devices. Remove related DEVMETHOD() lines from USB
drivers.
MFC r224107:
Clear pending ifnet events, in an attempt at preventing
ng_ether_link_state() from being dispatched after we have
cleared our IFP2NG(ifp).
MFC: r223774
The algorithm used by nfscl_getopen() could have resulted in
multiple instances of the same lock_owner when a process both
inherited an open file descriptor plus opened the same file itself.
Since some NFSv4 servers cannot handle multiple instances of
the same lock_owner string, this patch changes the algorithm
used by nfscl_getopen() in the new NFSv4 client to keep that
from happening. The new algorithm is simpler, since there is
no longer any need to ascend the process's parentage tree because
all NFSv4 Closes for a file are done at VOP_INACTIVE()/VOP_RECLAIM(),
making the Opens indistinct w.r.t. use with Lock Ops.
This problem was discovered at the recent NFSv4 interoperability
Bakeathon.
Add an option to have a fail point term only execute when run by a
specified pid. This is helpful for automated testing involving a global
knob that would otherwise be executed by many other threads.
MFC: r223747
Modify the new NFSv4 client so that it appends a file handle
to the lock_owner4 string that goes on the wire. Also, add
code to do a ReleaseLockOwner Op on the lock_owner4 string
before a Close. Apparently not all NFSv4 servers handle multiple
instances of the same lock_owner4 string, at least not in a
compatible way. This patch avoids having multiple instances,
except for one unusual case, which will be fixed by a future commit.
Found at the recent NFSv4 interoperability Bakeathon.
MFC r223886:
Implement a helper functions to locally set thread-private flag, and
restore it to the previous state. Note that only setting a flag locally
is supported.
MFC r223887:
Use helper functions instead of manually managing TDP_INBDFLUSH.
MFC r223888:
Use 'curthread_pflags' instead of 'thread_pflags' to signify that only
curthread can be operated upon.
Remember to unlock the peripheral prior to notifying the user. Make some
allocations M_NOWAIT so that we don't try and sleep with a nested non-sleepable
lock.
This makes the userland scsi_target begin to function again.
MFC 223870,223937:
- Note that -a, -C, -H, -j, and -z are also toggles.
- Add a leading space to the status messages output after toggling the
'C' and 'H' flags at runtime. This matches messages output for other
toggles which leave the first column in the message blank to hold the
cursor.
MFC 223510:
Don't die if either of INET or INET6 aren't in the running kernel.
Instead, report "protocol not supported" errors at runtime if a user
attempts to use a protocol that the kernel doesn't support.
MFC 223477,223597,223611:
- The recent change to increase the zfsboot size to 64k made a few BIOSes
unhappy (probably they don't handle crossing the 64k boundary, etc.).
Fix this by changing zfsldr to use a loop reading from the disk one
sector at a time. To avoid trashing the saved copy of the MBR which is
used for disk I/O, read zfsboot2 at address 0x9000. This has the
advantage that BTX no longer needs to be relocated as it is read into
the correct location. However, the loop to relocate zfsboot2.bin can
now cross a 64k boundary, so change it to use relative segments instead.
(This will need further work if zfsboot2.bin ever exceeds 64k.)
While here, stop storing a relocated copy of zfsldr at 0x700. This was
only used by the xread hack which has recently been removed (and even
that use was dubious). Also, include the BIOS error code as hex when
reporting read errors to aid in debugging.
- Remove the fake BPB from zfsldr. zfsldr doesn't support booting from
floppies, so it will not be used as the start of an emulated floppy
image on a bootable CD which is what the fake BPB was used for.
- Only check that EDD packet mode is available once at the start of
zfsldr rather than for each disk sector now that we read data in one
sector at a time. As a result, collapse the remaining bits of read
up into nread and rename nread to read.
MFC 223091:
Add location and pnpinfo strings for puc device ports. The location is
announced during boot and contains the port number. The pnpinfo string
lists the port type (PUC_TYPE_* constants).
Make activemap_write_start/complete check the keepdirty list, when
stating if we need to update activemap on disk. This makes keepdirty
serve its purpose -- to reduce number of metadata updates.
Discussed with: pjd
r223655, 223974:
Check the returned value of activemap_write_complete() and update matadata on
disk if needed. This should fix a potential case when extents are cleared in
activemap but metadata is not updated on disk.
MFC r223661:
Improve error reporting. Use corresponding error message when file to be
preprocessed is missing. Also suggest to use absolute pathname if -p
option is specified.
MFC: r223940: If one's message is longer than the buffer size, then we reset
'cnt' at the wrong point and the actual column # get out of sync across the
buffer size.