summaryrefslogtreecommitdiff
path: root/sys/dev/pv
AgeCommit message (Collapse)Author
2020-07-06Add support for timeconting in userland.Paul Irofti
This diff exposes parts of clock_gettime(2) and gettimeofday(2) to userland via libc eliberating processes from the need for a context switch everytime they want to count the passage of time. If a timecounter clock can be exposed to userland than it needs to set its tc_user member to a non-zero value. Tested with one or multiple counters per architecture. The timing data is shared through a pointer found in the new ELF auxiliary vector AUX_openbsd_timekeep containing timehands information that is frequently updated by the kernel. Timing differences between the last kernel update and the current time are adjusted in userland by the tc_get_timecount() function inside the MD usertc.c file. This permits a much more responsive environment, quite visible in browsers, office programs and gaming (apparently one is are able to fly in Minecraft now). Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others! OK from at least kettenis@, cheloha@, naddy@, sthen@
2020-06-29avoid a NULL deref in xen_intr_barrier()Jonathan Gray
intr_barrier() now uses the argument so directly call sched_barrier(NULL) which is what intr_barrier(NULL) used to do until recently. From Todd Carson on bugs@ ok dlg@
2020-06-27Nuke trailing whitespace.Kenneth R Westerback
2020-06-27No need to bzero()/memset() 'struct scsibus_attach_args' variablesKenneth R Westerback
immediately before initializing the only field in the struct.
2020-06-27Replace TAILQ concatenation loop with TAILQ_CONCATbket
As a result remove unneeded variable OK kn@, millert@
2020-06-24kernel: use gettime(9)/getuptime(9) in lieu of time_second(9)/time_uptime(9)cheloha
time_second(9) and time_uptime(9) are widely used in the kernel to quickly get the system UTC or system uptime as a time_t. However, time_t is 64-bit everywhere, so it is not generally safe to use them on 32-bit platforms: you have a split-read problem if your hardware cannot perform atomic 64-bit reads. This patch replaces time_second(9) with gettime(9), a safer successor interface, throughout the kernel. Similarly, time_uptime(9) is replaced with getuptime(9). There is a performance cost on 32-bit platforms in exchange for eliminating the split-read problem: instead of two register reads you now have a lockless read loop to pull the values from the timehands. This is really not *too* bad in the grand scheme of things, but compared to what we were doing before it is several times slower. There is no performance cost on 64-bit (__LP64__) platforms. With input from visa@, dlg@, and tedu@. Several bugs squashed by visa@. ok kettenis@
2020-06-24Use SDEV_NO_ADAPTER_TARGET instead of the value that is beingKenneth R Westerback
aassigned to adapter_buswidth to indicate the adapter is not a target on the bus. ok dlg@ as part of a larger diff.
2020-06-24Use SDEV_NO_ADAPTER_TARGET instead of the value of adapter_buswidth toKenneth R Westerback
indicate the adapter is not a target on the bus. ok dlg@ as part of a larger diff.
2020-06-24Nuke some pointless *_dev_probe() and *_dev_free() functions andKenneth R Westerback
set/trust the scsiconf.c probing limits. Same as was done to vioblk(4). ok dlg@
2020-06-22use ifiq_input and use it's return value to apply backpressure to rxrs.David Gwynne
this is a step toward deprecating softclock based livelock detection.
2020-06-21Nuke pointless vioblk_dev_probe() and vioblk_dev_free() functions andKenneth R Westerback
tweak adapter_target and adapter_buswidth values to provide desired semantic of providing only target 0/lun 0 device per vioblk(4) device. Tested by sf@
2020-05-29dev/rndvar.h no longer has statistical interfaces (removed during variousTheo de Raadt
conversion steps). it only contains kernel prototypes for 4 interfaces, all of which legitimately belong in sys/systm.h, which are already included by all enqueue_randomness() users.
2020-02-16Force a guest info update when we get a Capabilities_Register command.Jonathan Matthew
ESXi doesn't carry the guest info over when a guest gets moved to a different host, and this appears to be the only hint the guest gets that this has happened. ok dlg@
2020-02-14IPS_MAXFER, NAX_XFER, and MAXBSIZE are all definedKenneth R Westerback
as (64 * 1024). Reduce confusion by using MAXPHYS (a.k.a. (64 * 1024)) as other drivers do.
2020-02-13Resolve a few issues with interrupt handlingMike Belopuhov
Upon a failed task_add, the adjusted reference counter needs to be decremented. xen_intr_schedule should follow the same logic as xen_intr. Tested by Niklas Hallqvist. Ok mpi@
2020-02-12Bring a few stragglers into line with the idiom used by the other 40+Kenneth R Westerback
scsi drivers. i.e. eliminate the struct scsi_adapter member in the softc and rely on the pointer to a static scsi_adapter in the struct scsi_link member.
2020-02-05Nuke unnecessary abstraction 'scsi_minphys()' which just callsKenneth R Westerback
'minphys()'. Just use & check for NULL instead, since 'minphys()' is always called on the code path ([cd|sd|st]minphys) that calls physio().
2020-01-26Shuffle some names around to make reading the code less headacheKenneth R Westerback
inducing. Rename scsi_adapter member 'scsi_minphys' to 'dev_minphys' to reflect what it is supposed to do. Use consistent naming convention (<dev>_minphys) for the actual device functions. No functional change.
2020-01-24cleanup unused headers generated by configJonathan Gray
ok tedu@ krw@ deraadt@
2020-01-23Use a consistant idiom/format when declaring scsi_adapter structuresKenneth R Westerback
in drivers. Terse one liners, NULLs instead of 0's, explicitly specify all members, etc. Nuke #ifdef notyet blocks related to the scsi_adapter in aic. No intentional functional change. ok tedu@
2020-01-22xbf(4): tsleep(9) -> tsleep_nsec(9); ok mikeb@cheloha
2020-01-11xenstore: *sleep(9) -> *sleep_nsec(9); ok mikeb@cheloha
2019-12-31Convert infinite sleeps to {m,t}sleep_nsec(9).Martin Pieuchot
ok kn@
2019-12-31include sys/sensors.h for sensor useJonathan Gray
2019-12-19Add size for free() in vio(4).Frederic Cambus
There is an existing allocsize variable tracking size of allocations, turns out we can pass it to free in the error path. OK florian@, mpi@
2019-12-13pvclock(4): attach even if when PVCLOCK_FLAG_TSC_STABLE is unsetpd
Attaches pvclock with lower priority (500) in case of unstable tsc (PVCLOCK_FLAG_TSC_STABLE) instead of not attaching at all. In this state, we do make sure to return a monotonically increasing number. This mostly helps openbsd guests on openbsd vmm(4) where a pvclock with unstable tsc is still better than i8254. ok mlarkin@
2019-12-13Always release interrupt source when unmasking the interruptMike Belopuhov
xen_intr_unmask_release was not decrementing the reference counter on the interrupt source structure when bailing out early which led to the refcnt overflow. From niklas, ok mlarkin
2019-10-25Remove some space before tab and other small indentation errors.Claudio Jeker
2019-10-07Attach Hyper-V guest services to VMBus 4.0Mike Belopuhov
Tested by Andre Stoebe and Remi Locherer. ok deraadt, tb
2019-09-01Adopt the SCSI versioning #define's from FreeBSD. Eliminate theKenneth R Westerback
now unneeded version_to_spc() mapping array, a duplicate #define and a couple of magic numbers. Toss in some comments for future generations of spelunkers. Makes it possible to check for specific SPC versions when new features or eliminated features require such a check. No intentional functional change.
2019-08-30Don't use misleadingly named SCSISPC() which returns SCSI version notKenneth R Westerback
SPC version. Use raw data in version field to check the SPC level until SCSISPC() is straightened out. Actually a bit clearer to read as the raw data is what is manipulated in adjacent code.
2019-08-06The vio(4) interface did not recover from mbuf shortage. The logicAlexander Bluhm
to start the rx tick did not work since we use if_rxr_get(). An easy fix is to start the rx timeout every second unconditionally. OK dlg@
2019-05-26Support virtio 1.0 for virtio_pciStefan Fritsch
virtio 1.0 for virtio_mmio it not yet implemented, but 0.9 devices continue to work.
2019-05-26Rework virtio_negotiate_features()Stefan Fritsch
Add a sc_driver_features field that is automatically used by virtio_negotiate_features() and during reinit. Make virtio_negotiate_features() return an error code. Virtio 1.0 has a special status bit for feature negotiation that means that negotiation can fail. Make virtio_negotiate_features() return an error code instead of the features. Make virtio_reinit_start() automatically call virtio_negotiate_features(). Add a convenience function virtio_has_feature() to make checking bits easier. Add an error check in viomb for virtio_negotiate_features because it has some feature bits that may cause negotiation to fail. More error checking in the child drivers is still missing. ok mlarkin@
2019-05-13vmm: add host side pvclockpd
Emulate kvm pvclock in vmm(4). Compatible with pvclock(4) in OpenBSD. Linux does not attach to this (yet). Fixes by reyk@ and tested extensively by reyk@, tb@ and phessler@ ok mlarkin@ phessler@ reyk@
2019-04-17Remove unused parameter from virtio_init_vq()Stefan Fritsch
2019-04-17Initialize virtqueue before passing it to deviceStefan Fritsch
Reported by Gary Zibrat
2019-03-24virtio: Add a few feature bit defines and namesStefan Fritsch
ok mlarkin@
2019-03-24virtio: Prepare for 64 feature bitsStefan Fritsch
virtio 1.0 supports an arbitrary number of feature bits. However, so far no more than 64 are used (compared to 32 in virtio 0.9). Adjust data types to support 64 feature bits. Later, we may want to use bitmaps and setbit(), ... to support even more feature bits. ok mlarkin@
2019-03-24virtio: adjust virtio_setup_queue prototype for 1.0Stefan Fritsch
Make it take an address instead of a PFN. Pass the virtqueue pointer. In virtio 1.0, more information has to be configured in the device. Also call virtio_setup_queue() after the information has been filled in. ok mlarkin@
2019-01-19virtio: Introduce defines for config(8) flagsStefan Fritsch
2019-01-19viomb: tweak feature negotiationStefan Fritsch
VIRTIO_F_RING_INDIRECT_DESC is always negotiated by the transport driver, no need to specify it explicitly. VIRTIO_BALLOON_F_MUST_TELL_HOST is not offered but is handled in the code. Offer it during negotiation, too.
2019-01-10Fix previousStefan Fritsch
It accidentally contained a part of a different diff.
2019-01-10Move some PCI-specific defines to a new virtio_pcireg.h fileStefan Fritsch
Also add some virtio 1.0 status and feature bits
2019-01-10Remove some more code if VIRTIO_DEBUG is 0Stefan Fritsch
2019-01-10Move some common defines to virtiovar.hStefan Fritsch
And fix some comments
2019-01-08viocon: Remove obsolete handling of sc_intrhandStefan Fritsch
2019-01-08virtio: Don't include feature strings without VIRTIO_DEBUGStefan Fritsch
They are only used if VIRTIO_DEBUG is enabled. This should make the kernel slightly smaller.
2018-12-05Correctly disable pvclock(4) on old hardware that lack a stable clockReyk Floeter
I falsely assumed that the KVM_FEATURE_CLOCKSOURCE_STABLE_BIT indicates that the actual clock values are stable, but it turned out that this isn't always the case. To detect if the clock value is stable, we now read it once in pvclock_attach() and check for the PVCLOCK_FLAG_TSC_STABLE flag. This needs further investigation. Reported and fix tested by johnw.mail at gmail.com OK chris@ phessler@
2018-11-24only attach pvclock(4) inside a KVM guestPeter Hessler
tested by brynet@ OK reyk@